Skip to content

proposal: x/crypto/ripemd320: add ripemd320 hashing #32087

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

Closed
0x-2a opened this issue May 16, 2019 · 5 comments
Closed

proposal: x/crypto/ripemd320: add ripemd320 hashing #32087

0x-2a opened this issue May 16, 2019 · 5 comments
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@0x-2a
Copy link

0x-2a commented May 16, 2019

Summary: Golang has the x/crypto/ripemd160 hashing implementation but not the ripemd320 implementation. Having already done most of the work implementing ripemd320 in Go, I would like to bring it in to x/crypto alongside its smaller counterpart.

Details:

  • The differences between ripemd variants are small and fairly simple to implement
  • Ripemd 320 and 160 are mostly the same except the 320 variant has a 320 bit output size rather than 160 bit.
  • Despite SHA being a better hash, Ripemd can be used in conjunction with SHA256 et al as a double-hashing technique to prevent against length-extension attacks
  • Rust recently adopted support for Ripemd320 alongside its 160 and I would like to see the same for golang RIPEMD-320 implementation RustCrypto/hashes#68
@gopherbot gopherbot added this to the Proposal milestone May 16, 2019
@0x-2a 0x-2a changed the title proposal: x/crypto: add ripemd320 hashing proposal: crypto: add ripemd320 hashing May 16, 2019
@0x-2a 0x-2a changed the title proposal: crypto: add ripemd320 hashing proposal: crypto/ripemd320: add ripemd320 hashing May 16, 2019
@0x-2a 0x-2a changed the title proposal: crypto/ripemd320: add ripemd320 hashing proposal: golang.org/x/crypto/ripemd320: add ripemd320 hashing May 16, 2019
@0x-2a 0x-2a changed the title proposal: golang.org/x/crypto/ripemd320: add ripemd320 hashing proposal: x/crypto/ripemd320: add ripemd320 hashing May 16, 2019
@MaxSem
Copy link

MaxSem commented May 17, 2019

Note that RIPEMD160 has been deprecated in #30141. RIPEMD320 doesn't add any extra security compared to 160, it just produces a longer hash. If you want something different from the SHA family, wouldn't some modern function like BLAKE2 be better?

@0x-2a
Copy link
Author

0x-2a commented May 17, 2019

Oddly I haven't been in this situation before where I'm offering to improve a deprecated feature 😄. Please advise.

The goal of this proposal is to better support ripemd for specific use cases, such as legacy software conversions. Unless users have a specific use case for ripemd, they should choose a better hash. Use cases could be designing for a target hash length over security (e.g. sha and ripemd in bitcoin) or legacy-app conversion (especially php). For whatever reason, Ripemd 160 and 320 were heavily used in the php community, and as users migrate legacy applications they are left looking to reimplement these algorithms on their own. Choosing a better hash isn't always feasible if older hashes are in the data transformation path, and there are many use cases where choosing hash length is more important than how secure it is (e.g. ddos prevention, proof of work, perf optimization).

I'm not familiar with BLAKE2, but I do like that is has support for multiple bit lengths already:

// The blocksize of BLAKE2b in bytes.
BlockSize = 128
// The hash size of BLAKE2b-512 in bytes.
Size = 64
// The hash size of BLAKE2b-384 in bytes.
Size384 = 48
// The hash size of BLAKE2b-256 in bytes.
Size256 = 32

@ALTree
Copy link
Member

ALTree commented May 17, 2019

The fact that the ripemd160 implementation in x/crypto was deprecated (as @MaxSem noted) makes it very unlikely that new code that implements ripemd320 will be accepted into the package, I'm afraid.

The goal of this proposal is to better support ripemd for specific use cases, such as legacy software conversions.

Note that this goal can also be served by putting your ripemd320 implementation in a package outside x/crypto.

cc @FiloSottile for a final decision, but I very much doubt this proposal will be accepted.

@ALTree ALTree added the Proposal-Crypto Proposal related to crypto packages or other security issues label May 17, 2019
@FiloSottile
Copy link
Contributor

Yup, I prefer not to add things to x/crypto that we aren't ready to recommend as the current best modern choice.

It's definitely something that should exist in the ecosystem though! I recommend making it a stand-alone module rather than an x/crypto fork, so it's easy to use as a dependency.

@0x-2a
Copy link
Author

0x-2a commented May 21, 2019

I've provided a home for future outdated algos, as there are some more I'd like to translate. Thank you for the feedback.

https://github.com/y3sh/go-legacy-crypto/

@golang golang locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
None yet
Development

No branches or pull requests

5 participants