-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Poseidon-BN254 hash functions (#1176)
* Move Poseidon tests * Add Poseidon hash functions and modify test * Move (failing) Poseidon tests back * Remove commented-out code
- Loading branch information
Showing
6 changed files
with
158 additions
and
17 deletions.
There are no files selected for viewing
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...test_data/poseidonperm_x5_254/Prover.toml → ...test_data/poseidon_bn254_hash/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
x1 = [0,1,2] | ||
x1 = [1,2] | ||
y1 = "0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a" | ||
x2 = [0,1,2,3,4] | ||
x2 = [1,2,3,4] | ||
y2 = "0x299c867db6c1fdd79dcefa40e4510b9837e60ebb1ce0663dbaa525df65250465" |
10 changes: 10 additions & 0 deletions
10
crates/nargo/tests/test_data/poseidon_bn254_hash/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use dep::std::hash::poseidon; | ||
|
||
fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) | ||
{ | ||
let hash1 = poseidon::bn254::hash_2(x1); | ||
constrain hash1 == y1; | ||
|
||
let hash2 = poseidon::bn254::hash_4(x2); | ||
constrain hash2 == y2; | ||
} |
10 changes: 0 additions & 10 deletions
10
crates/nargo/tests/test_data/poseidonperm_x5_254/src/main.nr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters