Skip to content

Commit d495770

Browse files
committed
refactor: use poseidon library
1 parent 98cf0ff commit d495770

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Nargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "nodash"
33
type = "lib"
44
description = "A Swiss knife for Noir"
5-
version = "0.41.0"
5+
version = "0.41.1"
66
authors = ["Oleh Misarosh <[email protected]>"]
77
repository = "https://github.com/olehmisar/nodash"
88
keywords = ["Noir", "nodash", "util", "hash"]
@@ -11,3 +11,4 @@ keywords = ["Noir", "nodash", "util", "hash"]
1111
[dependencies]
1212
sha256 = { tag = "v0.1.2", git = "https://github.com/noir-lang/sha256" }
1313
keccak256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/keccak256" }
14+
poseidon = { tag = "v0.1.0", git = "https://github.com/noir-lang/poseidon" }

src/hash.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub fn poseidon2<let N: u32>(input: impl ArrayOrBoundedVec<Field, N>) -> Field {
22
let input = input.as_bounded_vec();
3-
std::hash::poseidon2::Poseidon2::hash(input.storage(), input.len())
3+
poseidon::poseidon2::Poseidon2::hash(input.storage(), input.len())
44
}
55

66
// TODO: is it possible for pedersen to accept BoundedVec?
@@ -67,11 +67,11 @@ mod tests {
6767
fn test_against_std() {
6868
assert(
6969
poseidon2(FIELD_INPUT_ARR)
70-
== std::hash::poseidon2::Poseidon2::hash(FIELD_INPUT_ARR, FIELD_INPUT_ARR.len()),
70+
== poseidon::poseidon2::Poseidon2::hash(FIELD_INPUT_ARR, FIELD_INPUT_ARR.len()),
7171
);
7272
assert(
7373
poseidon2(FIELD_INPUT_VEC_LONGER)
74-
== std::hash::poseidon2::Poseidon2::hash(
74+
== poseidon::poseidon2::Poseidon2::hash(
7575
FIELD_INPUT_VEC_LONGER.storage(),
7676
FIELD_INPUT_VEC_LONGER.len(),
7777
),

0 commit comments

Comments
 (0)