easy to use conversion from and to string for ethstore::Crypto (#5437)
* easy to use conversion from and to string for ethstore::Crypto * ethstore uses tempdir instead of devtools * ethstore does not depend on ethcore-util
This commit is contained in:
@@ -94,11 +94,11 @@ pub trait Keccak256<T> {
|
||||
fn keccak256(&self) -> T where T: Sized;
|
||||
}
|
||||
|
||||
impl Keccak256<[u8; 32]> for [u8] {
|
||||
impl<T> Keccak256<[u8; 32]> for T where T: AsRef<[u8]> {
|
||||
fn keccak256(&self) -> [u8; 32] {
|
||||
let mut keccak = Keccak::new_keccak256();
|
||||
let mut result = [0u8; 32];
|
||||
keccak.update(self);
|
||||
keccak.update(self.as_ref());
|
||||
keccak.finalize(&mut result);
|
||||
result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user