Skip to content

Commit 0998fc3

Browse files
authored
chore: bump tiny-keccak (#127)
1 parent 77ea53b commit 0998fc3

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

Cargo.lock

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/primitives/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ reth-codecs = { version = "0.1.0", path = "../codecs" }
1515
# ethereum
1616
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
1717
parity-scale-codec = { version = "3.2.1", features = ["derive", "bytes"] }
18-
tiny-keccak = "0.3"
18+
tiny-keccak = { version = "2.0", features = ["sha3"] }
1919

2020
#used for forkid
2121
crc = "1"

crates/primitives/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ pub use __reexport::*;
6666

6767
/// Returns the keccak256 hash for the given data.
6868
pub fn keccak256(data: impl AsRef<[u8]>) -> H256 {
69-
let mut res: [u8; 32] = [0; 32];
70-
tiny_keccak::keccak_256(data.as_ref(), &mut res);
71-
res.into()
69+
use tiny_keccak::{Hasher, Sha3};
70+
let mut sha3 = Sha3::v256();
71+
let mut output = [0; 32];
72+
sha3.update(data.as_ref());
73+
sha3.finalize(&mut output);
74+
output.into()
7275
}

0 commit comments

Comments
 (0)