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/blake2s: add 224bit variant #36429

Open
cathugger opened this issue Jan 7, 2020 · 3 comments
Open

x/crypto/blake2s: add 224bit variant #36429

cathugger opened this issue Jan 7, 2020 · 3 comments
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@cathugger
Copy link

cathugger commented Jan 7, 2020

What version of Go are you using (go version)?

irrelevant

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

irrelevant

What did you do?

Went to https://godoc.org/golang.org/x/crypto/blake2s and looked for 224bit version.

What did you expect to see?

Something like func New224(key []byte) (hash.Hash, error) (kinda like in crypto/sha256) or func New(size int, key []byte) (hash.Hash, error) (like in x/crypto/blake2b).

What did you see instead?

I didn't find anything what would clearly enable using canonical blake2s-224 hash.
Truncating New256 output would be ugly and wouldn't match canonical blake2s-224 (output size is embedded into IV).
I don't think blake2s XOF would provide canonical blake2s-224 either.

@gopherbot gopherbot added this to the Unreleased milestone Jan 7, 2020
@cathugger cathugger changed the title x/crypto/blake2s: no 224bit version x/crypto/blake2s: no 224bit variant Jan 7, 2020
@toothrot toothrot changed the title x/crypto/blake2s: no 224bit variant x/crypto/blake2s: add 224bit variant Jan 7, 2020
@toothrot toothrot added FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 7, 2020
@toothrot
Copy link
Contributor

toothrot commented Jan 7, 2020

/cc @FiloSottile @katiehockman

@cathugger
Copy link
Author

btw I can provide patch if needed, just not exactly sure about desired API.
It'll probably be func New(size int, key []byte) (hash.Hash, error) as that'd mirror blake2b's API, and allow more choices blake2s is capable of.
I'm unsure if Sum()-like API should be added, blake2b have them fixed-length without 224bit variant, and sha3's ShakeSum128/ShakeSum256 functions don't actually have output length distinguishers, so it wouldn't act exactly the same.

@Nephirus
Copy link

Nephirus commented Jul 8, 2020

I've created a pull request for this issue, using API suggestion by @cathugger

golang/crypto#147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest 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