mirror of https://github.com/poanetwork/hbbft.git
update tiny-keccak
This commit is contained in:
parent
41a955906b
commit
d6ffccc06e
|
@ -34,7 +34,7 @@ rand_derive = "0.5.0"
|
|||
reed-solomon-erasure = "3.1.1"
|
||||
serde = { version = "1.0.102", features = ["derive", "rc"] }
|
||||
threshold_crypto = { rev = "624eeee", git = "https://github.com/poanetwork/threshold_crypto" }
|
||||
tiny-keccak = "1.5.0"
|
||||
tiny-keccak = { version = "2.0.0", features = ["sha3"]}
|
||||
|
||||
[dev-dependencies]
|
||||
colored = "1.9.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::mem;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tiny_keccak::sha3_256;
|
||||
use tiny_keccak::{Hasher, Sha3};
|
||||
|
||||
pub type Digest = [u8; 32];
|
||||
|
||||
|
@ -141,7 +141,12 @@ fn hash_pair<T0: AsRef<[u8]>, T1: AsRef<[u8]>>(v0: &T0, v1: &T1) -> Digest {
|
|||
|
||||
/// Returns the SHA-256 hash of the value's `[u8]` representation.
|
||||
fn hash<T: AsRef<[u8]>>(value: T) -> Digest {
|
||||
sha3_256(value.as_ref())
|
||||
let mut sha3 = Sha3::v256();
|
||||
sha3.update(value.as_ref());
|
||||
|
||||
let mut out = [0u8; 32];
|
||||
sha3.finalize(&mut out);
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in New Issue