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

Add cSHAKE128 and cSHAKE256 implementations #325

Closed
wants to merge 2 commits into from

Conversation

elichai
Copy link

@elichai elichai commented Nov 12, 2021

A few notes about the implementation:

  1. I left the code for changing the function name (N) commented out, I can either remove it, or leave it with an empty function name (although that might degrade the performance a little bit).
  2. I added another Sha3State so CSHAKE can implement Reset without allocating the customization string. but because of that I couldn't use the state macro.
  3. I added a has_customization boolean that if it's not it makes it the same as SHAKE.
  4. I had to copy some logic from digest::dev because nothing there could support a hash function that doesn't implement Default (We could prob extend xof_test to accept a constructor, but we'll need a different new_test! macro that will support Blob3 and know to call new on the hasher with the customization)

The test vectors are from https://github.com/damaki/libkeccak/tree/master/tests/kat/testvectors/cSHAKE together with the current SHAKE tests for an empty customization.

@elichai
Copy link
Author

elichai commented Nov 13, 2021

I'm starting to think it might be better to remove the Reset implementation so that not everyone will need to pay for that extra State just for the few people that actually use it.

@newpavlov
Copy link
Member

Sorry for the late reply! Can you please rebase and update the code to digest v0.10?

@elichai
Copy link
Author

elichai commented Feb 10, 2022

Superceeded by #355

@elichai elichai closed this Feb 10, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants