aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/hash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/hash.rs')
-rw-r--r--src/crypto/hash.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index a9711e92..1f8a3936 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -1,6 +1,7 @@
use libc::c_uint;
use std::ptr;
use std::io;
+use std::iter::repeat;
use ffi;
@@ -101,7 +102,7 @@ impl Hasher {
* initialization and its context for reuse
*/
pub fn finalize_reuse(self) -> (Vec<u8>, HasherContext) {
- let mut res = Vec::from_elem(self.len, 0u8);
+ let mut res = repeat(0u8).take(self.len).collect::<Vec<_>>();
unsafe {
ffi::EVP_DigestFinal_ex(self.ctx.ptr, res.as_mut_ptr(), ptr::null_mut())
};