updated tiny_keccak library

This commit is contained in:
debris 2015-12-01 01:35:32 +01:00
parent eb8f04a3e6
commit 1934cb3bdd
2 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ arrayvec = "0.3"
mio = "0.4.4"
rand = "0.3.12"
time = "0.1.34"
tiny-keccak = "0.3"
tiny-keccak = "1.0"
rocksdb = "0.2.1"
num = "0.1"
lazy_static = "0.1.*"

View File

@ -1,5 +1,5 @@
use std::mem::uninitialized;
use tiny_keccak::keccak_256;
use tiny_keccak::Keccak;
use bytes::BytesConvertable;
use hash::{FixedHash, H256};
@ -10,8 +10,10 @@ pub trait Hashable {
impl<T> Hashable for T where T: BytesConvertable {
fn sha3(&self) -> H256 {
unsafe {
let mut keccak = Keccak::new_keccak256();
keccak.update(self.bytes());
let mut ret: H256 = uninitialized();
keccak_256(self.bytes(), ret.mut_bytes());
keccak.finalize(ret.mut_bytes());
ret
}
}