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

Faster alternative to BLAKE2bp #282

Closed
jedisct1 opened this issue Mar 19, 2019 · 7 comments
Closed

Faster alternative to BLAKE2bp #282

jedisct1 opened this issue Mar 19, 2019 · 7 comments
Labels
🎉 enhancement New feature!

Comments

@jedisct1
Copy link

Something for you:

https://docs.rs/sthash - https://github.com/jedisct1/rust-sthash

Note that you will need to generate and store a secret seed (once for the whole cache). This is critical in order to protect against forgery, especially with large files.

@jedisct1 jedisct1 added the 🎉 enhancement New feature! label Mar 19, 2019
@lachlansneff
Copy link
Contributor

How/where do you recommend we store the secret seed?

@jedisct1
Copy link
Author

Is the cache directory something guest webassembly modules are supposed to ever have access to?
I guess not, especially if the cache is shared by multiple customers.

In this context, simply storing the key as a file with a fixed name in the cache directory should be acceptable.

@jedisct1
Copy link
Author

The last versions have AVX2 support, and should be about 5x faster than BLAKE2bp on Nehalem.

@Hywan
Copy link
Contributor

Hywan commented Mar 20, 2019

Thanks for the suggestion. It seems to be a solid candidate!

@repi
Copy link
Contributor

repi commented Apr 12, 2019

We've started using wasmer here at Embark and for our game runtime use cases I would be hesitant of any hashes (or other code) that use AVX2. Because using those instructions unfortunately slows down the rest of the CPU so often is an overall net loss in performance due to frequency throttling.

Could be available as an option though if one already is running with AVX2/512 and is throttled. Or simply wants the fastest possible hashing for a use case.

@jedisct1
Copy link
Author

The current code already heavily depends on AVX2. And STHash is faster than the current hash even without vectorization.

AVX512 quickly gets CPUs to reduce their frequency. Throttling due to AVX2 is more reasonable, but more importantly, STHash only uses AVX2 (if available) for very short amounts of time. NH evaluations alternate with Poly1305 evaluations that don't use vector extensions. On a 8 cores Core i7, I couldn't get the CPU to throttle during STHash benchmarks, so this is unlikely to happen on Xeons either.

@syrusakbary
Copy link
Member

syrusakbary commented Jan 14, 2020

We just started using blake3 as it has great performance compared to blake2b, I believe in a similar scale as sthash. (here's the related PR: #1140)

Closing the issue :)

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

No branches or pull requests

5 participants