-
Notifications
You must be signed in to change notification settings - Fork 432
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
Would this repo be open to a SIMD implementation of ChaCha20? #667
Comments
Just curious: Are the optimizations in https://github.com/cesarb/chacha20-poly1305-aead/ any different? |
I think there's a substantial difference. I'm not familiar with that code, but by the looks of it it's operating on |
Looks like |
They also apply |
When I added the ChaCha generator a lifetime ago, having compatible SIMD implementations was precisely the goal. At the time, however, there were no intrinsics or any good way to write it in Rust, so it seems to have stayed with the reference "one-star performance" implementation ever since. In my experience writing C++ You can also add forward security (which for some reason is listed as a feature on the documentation) to ChaCha8 very easily, at virtually no cost in performance, but this loses compatibility and jump-ahead capability. |
Yes, @oconnor663, very much. Replacing PCG is another thing altogether; it really depends on whether you want a secure batched RNG or a minimal-memory-usage RNG. As such we shouldn't talk about replacing PCG with ChaCha in |
We could consider removing |
I guess we could, but that's off-topic here and a quick search shows that |
FYI, I've been meaning to push a |
There is another SIMD implementation: https://github.com/cryptocorrosion/cryptocorrosion/tree/master/stream-ciphers/chacha |
@kazcw would you be open to adding Alternatively we could update the |
@dhardy Sure, I'll try to get to it this weekend |
There's an open PR to add ChaCha20 support to RustCrypto, which could be published as the Personally I think it'd be swell if people could combine efforts on a single, high-quality, well-maintained ChaCha20 implementation all Rust users could leverage. |
Performance: gen_bytes_chacha20: 254 MB/s -> 603 MB/s [on a Xeon L5630 (SSE4.1)] Minor version bump: the only breaking change is that no-std builds now require default-features=false (std is required by default for runtime cpu detection; no_std builds will use the best implementation supported by the target-features/target-cpu enabled at compile time) New functionality: ChaChaXRng is parameterized by round count at compile time. Convenient aliases for the typical 20/12/8 round implementations exposed. ChaChaRng is aliased to ChaCha20Rng for backward compatibility. Closes rust-random#667
There's probably a factor of 5-6x to be had here. I could potentially port in some experimental code I have in https://github.com/oconnor663/chacha20_simd. What do people think?
The text was updated successfully, but these errors were encountered: