chore: reexport sha3 from primitives (#109)

* chore: reexport sha3 from primitives

* feat: add keccak256

* replace sha3 with tinykeccak
This commit is contained in:
Matthias Seitz
2022-10-20 16:43:29 +02:00
committed by GitHub
parent 4536e09c99
commit e9945b565a
3 changed files with 35 additions and 8 deletions

View File

@ -8,19 +8,24 @@ readme = "README.md"
description = "Commonly used types in reth."
[dependencies]
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
bytes = "1.2"
serde = "1.0"
thiserror = "1"
# reth
reth-rlp = { path = "../common/rlp", features = ["std", "derive", "ethereum-types"]}
parity-scale-codec = { version = "3.2.1", features = ["derive", "bytes"] }
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"
#used for forkid
crc = "1"
maplit = "1"
# misc
bytes = "1.2"
serde = "1.0"
thiserror = "1"
[dev-dependencies]
serde_json = "1.0"
hex-literal = "0.3"

View File

@ -49,3 +49,18 @@ pub use ethers_core::{
types as rpc,
types::{Bloom, Bytes, H128, H160, H256, H512, H64, U128, U256, U64},
};
#[doc(hidden)]
mod __reexport {
pub use tiny_keccak;
}
// Useful reexports
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()
}