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

View File

@ -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 = "0.3"
tiny-keccak = { version = "2.0", features = ["sha3"] }
#used for forkid
crc = "1"

View File

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