Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/crypto/blake2b: provide reset that allows specifying a new key #35633

Open
josharian opened this issue Nov 16, 2019 · 2 comments
Open

x/crypto/blake2b: provide reset that allows specifying a new key #35633

josharian opened this issue Nov 16, 2019 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@josharian
Copy link
Contributor

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

@gopherbot gopherbot added this to the Unreleased milestone Nov 16, 2019
@aead
Copy link
Contributor

aead commented Nov 16, 2019

/cc @FiloSottile

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 18, 2019
@josharian
Copy link
Contributor Author

ping @FiloSottile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants