On Thu, Nov 28, 2013 at 06:38:47AM +0100, Niels Möller wrote:
You must call sha1_init(&hash_ctx) before the first sha1_update.
Erm, yes. Sorry, the real code has this :)
Does doing the sha1_digest alter state in some way? I can't image it is, but then how does this behavior crop up?
sha1_digest implies a sha1_init. So with sha1_digest(...); sha1_digest(...), the second call gives you the sha1 digest of the empty string. I think this is explained in the manual, http://www.lysator.liu.se/~nisse/nettle/nettle.html#Legacy-hash-functions
Erm, so it is. Sorry 'bout that. Thanks!
Regards, /Niels
-- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance.
Cheers, Paul