blake2b digests are pretty large. They account for 60% of allocated space in my benchmark, so they're a good candidate for re-use, except that (at least in my case, PASETO), I need to use a new key every time. It'd be nice if there was a reset function that let me specify a new key.
The API options for this aren't particularly nice, since the blake2b functions all return hash.Hash instead of a concrete type. The two options I see are: (1) provide a package-level ResetKey function that accepts a hash.Hash and panics if given the wrong kind of hash, and (2) provide a package-level ResetKey interface and promise that blake2b hash.Hashes can be type-asserted to that interface. (Or some other name. The reset should perhaps also accept a new size.)
If there's API consensus, I can try my hand at implementing.
cc the three people who have touched that file: @aead @rasa @ValarDragon
blake2b digests are pretty large. They account for 60% of allocated space in my benchmark, so they're a good candidate for re-use, except that (at least in my case, PASETO), I need to use a new key every time. It'd be nice if there was a reset function that let me specify a new key.
The API options for this aren't particularly nice, since the blake2b functions all return
hash.Hash
instead of a concrete type. The two options I see are: (1) provide a package-levelResetKey
function that accepts ahash.Hash
and panics if given the wrong kind of hash, and (2) provide a package-levelResetKey
interface and promise that blake2bhash.Hash
es can be type-asserted to that interface. (Or some other name. The reset should perhaps also accept a new size.)If there's API consensus, I can try my hand at implementing.
cc the three people who have touched that file: @aead @rasa @ValarDragon