mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: use correct hash function (#138)
This commit is contained in:
@ -15,7 +15,7 @@ reth-codecs = { version = "0.1.0", path = "../codecs" }
|
||||
# ethereum
|
||||
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
|
||||
parity-scale-codec = { version = "3.2.1", features = ["derive", "bytes"] }
|
||||
tiny-keccak = { version = "2.0", features = ["sha3"] }
|
||||
tiny-keccak = { version = "2.0", features = ["keccak"] }
|
||||
|
||||
#used for forkid
|
||||
crc = "1"
|
||||
|
||||
@ -68,10 +68,10 @@ pub use __reexport::*;
|
||||
|
||||
/// Returns the keccak256 hash for the given data.
|
||||
pub fn keccak256(data: impl AsRef<[u8]>) -> H256 {
|
||||
use tiny_keccak::{Hasher, Sha3};
|
||||
let mut sha3 = Sha3::v256();
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
let mut keccak = Keccak::v256();
|
||||
let mut output = [0; 32];
|
||||
sha3.update(data.as_ref());
|
||||
sha3.finalize(&mut output);
|
||||
keccak.update(data.as_ref());
|
||||
keccak.finalize(&mut output);
|
||||
output.into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user