-
Notifications
You must be signed in to change notification settings - Fork 267
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
Refactor k12 #353
Refactor k12 #353
Conversation
For K12, it would be interesting to also have SIMD implementations of parallel Keccak-p permutations. Sorry, I cannot help directly because I am not fluent in Rust, but I can at least point out such implementations in XKCP/K12 for inspiration. |
Yes, that definitely would get some nice improvements. Currently I have made a draft PR for SIMD backed Keccak-f permutations in RustCrypto/sponges#8. As soon as this is available, the k12 implementation could be updated to incorporate it. EDIT: RustCrypto/sponges#8 would need an generic SIMD backed keccak-p permutation for use within k12. I'll extend the draft PR. |
I was not aware of that PR. Nice! |
@aewag this is great work. Anything I can do to help move it along? |
If you have time to review RustCrypto/sponges#7, that would be great. Other than that, this propably needs a rebase and should more or less work. (I planned to further update the implementation to be alloc-free and maybe also in the future with SIMD support, but I will not able to work on this in the near future.) EDIT: I just rebased this on top of the current master. |
@aewag went ahead and merged RustCrypto/sponges#7. We can probably cut another release of the I wanted to point out this is probably the biggest problem with the Lines 37 to 39 in 1cdbd53
It buffers all of the input in a Lines 128 to 177 in 1cdbd53
That makes the implementation unusable for large inputs, and it doesn't properly implement the |
Yep, agreed. I started to work on these (two) issue(s), but I don't have yet a working implementation. |
f5ec773
to
5f4996e
Compare
46da7e0
to
a16eb1b
Compare
@tarcieri I finished the refactoring. The PR is ready for review. |
Remove the use of vectors and implement `XofReader`.
Thank you! 👍 |
I can cut a release if you'd like |
Yeah, that would be nice. Thanks! |
The k12 crate had its own keccak-p permutation implementation.
With RustCrypto/sponges#7 a generic keccak-p implementation would be available, which could be used within the k12 crate.With #458 TurboSHAKE is available, which can be used within the
k12
crate.k12
uses a block size of 8192 to split the input. The maximum supported block size ofblock-buffer
is limited to 256. Therefore this implementation buffers the input within an additional array.