fix reading beyond hash length

In the concentric circles and nested squares patterns, when `i = 0`
i.e. the top left corner of the pattern, `val` for the inner shape is
read from `hash[40]`, but the hash itself is only 40 characters long.
Merge pull request #24 from btmills/master

fix reading beyond hash length