removed unneeded extra alloc
This commit is contained in:
@@ -20,11 +20,10 @@ impl Hasher for BLAKE256 {
|
|||||||
self.hasher.update(bytes.as_ref())
|
self.hasher.update(bytes.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete(self) -> HashReturn {
|
fn complete(mut self) -> HashReturn {
|
||||||
let res = self.hasher.finalize_boxed();
|
let res = self.hasher.finalize_boxed();
|
||||||
let mut ret = BITS256::default();
|
self.hash.copy_from_slice(&res);
|
||||||
ret.copy_from_slice(&res);
|
HashReturn::BLAKE256(self.hash)
|
||||||
HashReturn::BLAKE256(ret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ impl Hasher for BLAKE3 {
|
|||||||
self.hasher.update(bytes.as_ref());
|
self.hasher.update(bytes.as_ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete(self) -> HashReturn {
|
fn complete(mut self) -> HashReturn {
|
||||||
let res = self.hasher.finalize();
|
let res = self.hasher.finalize();
|
||||||
let mut ret = BITS256::default();
|
self.hash.copy_from_slice(res.as_bytes());
|
||||||
ret.copy_from_slice(res.as_bytes());
|
HashReturn::BLAKE3(self.hash)
|
||||||
HashReturn::BLAKE3(ret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,10 @@ impl Hasher for BLAKE512 {
|
|||||||
self.hasher.update(bytes.as_ref())
|
self.hasher.update(bytes.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete(self) -> HashReturn {
|
fn complete(mut self) -> HashReturn {
|
||||||
let res = self.hasher.finalize_boxed();
|
let res = self.hasher.finalize_boxed();
|
||||||
let mut ret = bits512_default();
|
self.hash.copy_from_slice(&res);
|
||||||
ret.copy_from_slice(&res);
|
HashReturn::BLAKE512(self.hash)
|
||||||
HashReturn::BLAKE512(ret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,10 @@ impl Hasher for MD5 {
|
|||||||
self.hasher.update(bytes.as_ref())
|
self.hasher.update(bytes.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete(self) -> HashReturn {
|
fn complete(mut self) -> HashReturn {
|
||||||
let res = self.hasher.finalize();
|
let res = self.hasher.finalize();
|
||||||
let mut ret = BITS128::default();
|
self.hash.copy_from_slice(&res);
|
||||||
ret.copy_from_slice(&res);
|
HashReturn::MD5(self.hash)
|
||||||
HashReturn::MD5(ret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user