updated tiny_keccak library
This commit is contained in:
parent
eb8f04a3e6
commit
1934cb3bdd
@ -14,7 +14,7 @@ arrayvec = "0.3"
|
|||||||
mio = "0.4.4"
|
mio = "0.4.4"
|
||||||
rand = "0.3.12"
|
rand = "0.3.12"
|
||||||
time = "0.1.34"
|
time = "0.1.34"
|
||||||
tiny-keccak = "0.3"
|
tiny-keccak = "1.0"
|
||||||
rocksdb = "0.2.1"
|
rocksdb = "0.2.1"
|
||||||
num = "0.1"
|
num = "0.1"
|
||||||
lazy_static = "0.1.*"
|
lazy_static = "0.1.*"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::mem::uninitialized;
|
use std::mem::uninitialized;
|
||||||
use tiny_keccak::keccak_256;
|
use tiny_keccak::Keccak;
|
||||||
use bytes::BytesConvertable;
|
use bytes::BytesConvertable;
|
||||||
use hash::{FixedHash, H256};
|
use hash::{FixedHash, H256};
|
||||||
|
|
||||||
@ -10,8 +10,10 @@ pub trait Hashable {
|
|||||||
impl<T> Hashable for T where T: BytesConvertable {
|
impl<T> Hashable for T where T: BytesConvertable {
|
||||||
fn sha3(&self) -> H256 {
|
fn sha3(&self) -> H256 {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let mut keccak = Keccak::new_keccak256();
|
||||||
|
keccak.update(self.bytes());
|
||||||
let mut ret: H256 = uninitialized();
|
let mut ret: H256 = uninitialized();
|
||||||
keccak_256(self.bytes(), ret.mut_bytes());
|
keccak.finalize(ret.mut_bytes());
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user