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

Supporting KangarooTwelve #108

Open
DonaldTsang opened this issue Dec 4, 2018 · 7 comments
Open

Supporting KangarooTwelve #108

DonaldTsang opened this issue Dec 4, 2018 · 7 comments

Comments

@DonaldTsang
Copy link

DonaldTsang commented Dec 4, 2018

I would like KangarooTwelve and MarsupilamiFourteen to be added to Multiformats as K12 is faster than SHA1, and M14 is expected to be as about as fast as SHA1 and twice as fast as SHA256.
Statistics: https://bench.cr.yp.to/results-hash.html#oki
M12 is 2.21 cpb, M14 is assumed to be 2.21*(14/12)*(168/136)=3.185 Cycles per byte
For comparison, SHA1 is 3.06 cpb, MD5 is 4.33 cpb, and SHA256 is 6.65 cpb

@Stebalien
Copy link
Member

Do they provide any benefit over blake2b?

@DonaldTsang
Copy link
Author

DonaldTsang commented Dec 4, 2018

@Stebalien According to the benchmark KangarooTwelve is 2.92/2.21=1.32x faster than BLAKE2b, since kangarooTwelve is engineered by Team Keccak to be an ultra-fast version of SHAKE arbitrary length hash (see https://keccak.team/kangarootwelve.html for more info)

@DonaldTsang
Copy link
Author

For future reference this will come in handy multiformats/multicodec#56

@Stebalien
Copy link
Member

I see, I was looking at a different benchmark. It appears to really depend on the CPU.

I'm not really against these but I'd like to carefully consider which ones are likely to be used for identifying content (needs a single byte code).

Do you know of any existing users of these hash functions?

@DonaldTsang
Copy link
Author

@Stebalien If I were to be in charge of Multihash, I would treat the multihash ID as book indexing, where each code can have up to 4 bytes, so that many different types of hashes are included.
My hash selection criteria is as follows:

  • High priority: MD-hash, SHA-1/2, (SHA3, SHAKE, K12), BLAKE2, Skein (all are useful and/or common)
  • Mid priority: SHA competition finalists and round 3 candidates whose speed are faster than SHA256, bcrypt, scrypt, Argon2 and other PHC "special recognition"
  • Low priority: Other SHA competition finalists and round 3 candidates, other PHC finalists

@Stebalien
Copy link
Member

I just don't want to regret any decisions later. Either regret choosing a short code because we never use it or regret choosing a long code because we find it really useful.

However, I agree with your analysis. This seems useful to include as either a 2 or 3 byte code.

@DonaldTsang
Copy link
Author

Since BLAKE3 exists as a replacement for BLAKE2, it might be a good idea to reconsider K12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants