Closed hanssv closed 5 years ago
While fiddling with the code I also started wondering why generichash_update
returns a new state - can the reference actually change or would it be more transparent not to return a state (and thus make it look more functional than it really is!) ?
I think it was modeled on the crypto:..._update/2
style functions which returns a new hash-state. But it made me ponder as well, because the linearity is assumed.
I think the whole generichash interface is one of those I have yet to throw through QuickCheck, and it shows. It would probably have caught it earlier.
Oh, and patch looks-good-to-me, I'll pull it in
At least according to: https://libsodium.gitbook.io/doc/hashing/generic_hashing
We noticed crashes when it was not 16-byte aligned - probably is architecture dependent. This makes the safe choice and always 64-byte align it.