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

Implemented gadgets for SHA-384 and SHA-512 #85

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tgodden
Copy link

@tgodden tgodden commented Jan 16, 2023

Description

This is an implementation of gadgets for SHA-384 and SHA-512 based on the implementation of the SHA-256 gadget.
The commits are based on the release-0.4 branch which is not yet merged into main.

The code relies on the fix for add_many proposed in the following pull request: arkworks-rs/r1cs-std#113.

There is some code duplication between the different SHA modules. This can likely be resolved with a bit of restructuring or by using macros to generate certain parts of the code.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (main)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

src/crh/sha384/mod.rs Outdated Show resolved Hide resolved
src/crh/sha384/mod.rs Outdated Show resolved Hide resolved
src/crh/sha512/mod.rs Outdated Show resolved Hide resolved
src/crh/sha512/mod.rs Outdated Show resolved Hide resolved
use ark_relations::r1cs::SynthesisError;
use core::iter;

/// Extra traits not automatically implemented by UInt64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this in two different locations, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't. I wasn't sure how you would like to resolve it, so I went with code duplication and a note in the pull request :)
I think we could create e.g. a subdirectory for SHA and use a macro to generate these traits for both 512-byte and 256-byte algorithms.

@tgodden tgodden requested a review from a team as a code owner January 9, 2024 02:08
@tgodden tgodden requested review from Pratyush, mmagician and weikengchen and removed request for a team January 9, 2024 02:08
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.

2 participants