chore: bump tiny-keccak (#127)

This commit is contained in:
Matthias Seitz
2022-10-25 02:06:25 +02:00
committed by GitHub
parent 77ea53bb6e
commit 0998fc3eb7
3 changed files with 10 additions and 13 deletions

12
Cargo.lock generated
View File

@ -934,7 +934,7 @@ dependencies = [
"impl-rlp", "impl-rlp",
"impl-serde", "impl-serde",
"scale-info", "scale-info",
"tiny-keccak 2.0.2", "tiny-keccak",
] ]
[[package]] [[package]]
@ -975,7 +975,7 @@ dependencies = [
"serde_json", "serde_json",
"strum", "strum",
"thiserror", "thiserror",
"tiny-keccak 2.0.2", "tiny-keccak",
"unicode-xid", "unicode-xid",
] ]
@ -2635,7 +2635,7 @@ dependencies = [
"serde_json", "serde_json",
"sucds", "sucds",
"thiserror", "thiserror",
"tiny-keccak 0.3.0", "tiny-keccak",
] ]
[[package]] [[package]]
@ -3503,12 +3503,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "tiny-keccak"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81cd8183d45872feda10001dfacfebf7e163e159922582cd919bed08732447c4"
[[package]] [[package]]
name = "tiny-keccak" name = "tiny-keccak"
version = "2.0.2" version = "2.0.2"

View File

@ -15,7 +15,7 @@ reth-codecs = { version = "0.1.0", path = "../codecs" }
# ethereum # ethereum
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false } ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
parity-scale-codec = { version = "3.2.1", features = ["derive", "bytes"] } parity-scale-codec = { version = "3.2.1", features = ["derive", "bytes"] }
tiny-keccak = "0.3" tiny-keccak = { version = "2.0", features = ["sha3"] }
#used for forkid #used for forkid
crc = "1" crc = "1"

View File

@ -66,7 +66,10 @@ pub use __reexport::*;
/// Returns the keccak256 hash for the given data. /// Returns the keccak256 hash for the given data.
pub fn keccak256(data: impl AsRef<[u8]>) -> H256 { pub fn keccak256(data: impl AsRef<[u8]>) -> H256 {
let mut res: [u8; 32] = [0; 32]; use tiny_keccak::{Hasher, Sha3};
tiny_keccak::keccak_256(data.as_ref(), &mut res); let mut sha3 = Sha3::v256();
res.into() let mut output = [0; 32];
sha3.update(data.as_ref());
sha3.finalize(&mut output);
output.into()
} }