Skip to content

Commit ee7b87f

Browse files
committed
feat: use keccak256 lib
1 parent 8d5dbdd commit ee7b87f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Nargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ authors = ["Oleh Misarosh <olehmisar@gmail.com>"]
55

66
[dependencies]
77
sha256 = { tag = "v0.1.2", git = "https://github.com/noir-lang/sha256" }
8+
keccak256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/keccak256" }

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Nodash is a utility library for [Noir](https://github.com/noir-lang/noir) langua
77
Put this into your Nargo.toml.
88

99
```toml
10-
nodash = { git = "https://github.com/olehmisar/nodash/", tag = "v0.39.6" }
10+
nodash = { git = "https://github.com/olehmisar/nodash/", tag = "v0.39.7" }
1111
```
1212

1313
## Docs

src/hash.nr

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn sha256<let N: u32>(input: impl ArrayOrBoundedVec<u8, N>) -> [u8; 32] {
1515

1616
pub fn keccak256<let N: u32>(input: impl ArrayOrBoundedVec<u8, N>) -> [u8; 32] {
1717
let input = input.as_bounded_vec();
18-
std::hash::keccak256(input.storage(), input.len())
18+
dep::keccak256::keccak256(input.storage(), input.len())
1919
}
2020

2121
/// Needed because of https://github.com/noir-lang/noir/issues/7054
@@ -81,6 +81,8 @@ mod tests {
8181
sha256(U8_INPUT_ARR)
8282
== dep::sha256::sha256_var(U8_INPUT_ARR, U8_INPUT_ARR.len() as u64),
8383
);
84-
assert(keccak256(U8_INPUT_ARR) == std::hash::keccak256(U8_INPUT_ARR, U8_INPUT_ARR.len()));
84+
assert(
85+
keccak256(U8_INPUT_ARR) == dep::keccak256::keccak256(U8_INPUT_ARR, U8_INPUT_ARR.len()),
86+
);
8587
}
8688
}

0 commit comments

Comments
 (0)