mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
update tiny-keccak (#4093)
* update tiny-keccak * fix * Update Cargo.toml * update Cargo.lock * remove keccak-hasher
This commit is contained in:
@@ -32,7 +32,7 @@ zeroize = { version = "0.10.1", default-features = false }
|
||||
lazy_static = { version = "1.4.0", default-features = false, optional = true }
|
||||
parking_lot = { version = "0.9.0", optional = true }
|
||||
libsecp256k1 = { version = "0.3.0", default-features = false, optional = true }
|
||||
tiny-keccak = { version = "1.5.0", optional = true }
|
||||
tiny-keccak = { version = "2.0.1", features = ["keccak"], optional = true }
|
||||
substrate-debug-derive = { version = "2.0.0", path = "./debug-derive" }
|
||||
externalities = { package = "substrate-externalities", path = "../externalities", optional = true }
|
||||
primitives-storage = { package = "substrate-primitives-storage", path = "storage", default-features = false }
|
||||
@@ -100,6 +100,7 @@ std = [
|
||||
full_crypto = [
|
||||
"ed25519-dalek",
|
||||
"blake2-rfc",
|
||||
"tiny-keccak",
|
||||
"schnorrkel",
|
||||
"libsecp256k1",
|
||||
"hex",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//! Hashing functions.
|
||||
|
||||
use blake2_rfc;
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
use twox_hash;
|
||||
|
||||
/// Do a Blake2 512-bit hash and place result in `dest`.
|
||||
@@ -121,3 +122,12 @@ pub fn twox_256(data: &[u8]) -> [u8; 32] {
|
||||
twox_256_into(data, &mut r);
|
||||
r
|
||||
}
|
||||
|
||||
/// Do a keccak 256 hash and return result.
|
||||
pub fn keccak_256(data: &[u8]) -> [u8; 32] {
|
||||
let mut keccak = Keccak::v256();
|
||||
keccak.update(data);
|
||||
let mut output = [0u8; 32];
|
||||
keccak.finalize(&mut output);
|
||||
output
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ pub use impl_serde::serialize as bytes;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
pub mod hashing;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
|
||||
pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256, keccak_256};
|
||||
#[cfg(feature = "std")]
|
||||
pub mod hexdisplay;
|
||||
pub mod crypto;
|
||||
|
||||
Reference in New Issue
Block a user