Merge pull request #698 from reaperhulk/hash-fix

Be more pedantic in checking the written size of the hash digest