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 new hashing functions (SHA & Keccak) #53

Closed
wants to merge 14 commits into from
Closed

Conversation

MartinMinkov
Copy link
Contributor

@MartinMinkov MartinMinkov commented Jun 21, 2023

Description

Implements o1-labs/rfcs#9

This PR adds support for hashing using various SHA algorithms and Keccak that is exposed in the OCaml bindings to be used by SnarkyJS. This is the layer in which the calls to Kimchi are made.

🔗 SnarkyJS o1-labs/o1js#999

@@ -8,6 +8,10 @@ module Poseidon : sig
type sponge
end

(**
This type definition is copy/pasted from the `snarkyjs_bindings.ml` using an LSP to see the type definition of `snarky`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the best way to describe how to add to this type? 🤔


let check_bits value bits =
Kimchi_gadgets.Lookup.less_than_bits (module Impl) ~bits value ;
Kimchi_gadgets.Range_check.bits64 (module Impl) Impl.Field.zero
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for calling Kimchi_gadgets.Range_check.bits64 is because less_than_bits expects a "dummy gate" to be initialized before calling it (as noted here). Calling this every time check_bits is called seems wasteful, is there a better way to initialize the range check once?

@MartinMinkov MartinMinkov marked this pull request as ready for review July 5, 2023 19:12
@mitschabaude
Copy link
Contributor

superseded by o1-labs/o1js#1291

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