-
Notifications
You must be signed in to change notification settings - Fork 50
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
Unify buffering logic between chacha20, salsa20, and ctr #95
Comments
I guess I'll note one of the main motivations for copying the buffering logic into the It'd be good to further optimize |
It may be also worth to unify with the cc @dhardy |
I see two different APIs: one with |
For RNGs we may use bit-level counters, so unification probably will not worth the trouble. |
See also: RustCrypto/traits#336 |
All three of these crates use highly similar (copypasta) buffering logic:
Original
ctr
code:Derived
chacha20
andsalsa20
code:The main problem is the
ctr
is presently specialized toCtr128
and intended to operate in conjunction with a block cipher, whereas it'd be nice ifChaCha20
andSalsa20
took an integer (32-bit and 64-bit respectively) used to compute the block, but reused the same buffering logic asCtr128
.ChaCha20 could also benefit from parallel block computation via its AVX2 backend.
The text was updated successfully, but these errors were encountered: