Merge branch 'master' of github.com:gavofyork/ethcore-util

This commit is contained in:
Gav Wood 2015-12-01 01:44:29 +01:00
commit e8ca520dad
2 changed files with 5 additions and 3 deletions

View File

@ -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.*"

View File

@ -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
} }
} }