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

chore: Add hash_to_field Noir alternative #3338

Merged
merged 4 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove the old hash_to_field method
kevaundray committed Oct 30, 2023
commit 2fb5e132042cf22433a5fd1afed9dede5a351d27
4 changes: 1 addition & 3 deletions noir_stdlib/src/hash.nr
Original file line number Diff line number Diff line change
@@ -20,9 +20,7 @@ pub fn pedersen_hash<N>(input : [Field; N]) -> Field {
#[foreign(pedersen_hash)]
pub fn pedersen_hash_with_separator<N>(_input : [Field; N], _separator : u32) -> Field {}

#[foreign(hash_to_field_128_security)]
pub fn hash_to_field<N>(_input : [Field; N]) -> Field {}
pub fn hash_to_field_native<N>(_input : [Field; N]) -> Field {
pub fn hash_to_field<N>(_input : [Field; N]) -> Field {
let mut inputs_as_bytes = [];

for i in 0..N {
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use dep::std;

fn main(input : Field) -> pub Field {
let expected = std::hash::hash_to_field([input]);
let got = std::hash::hash_to_field_native([input]);
assert(expected == got);
expected
std::hash::hash_to_field([input])
}