aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/hash.rs
diff options
context:
space:
mode:
authorChris Cole <[email protected]>2015-01-03 19:31:14 -0500
committerChris Cole <[email protected]>2015-01-03 19:31:14 -0500
commitfde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6 (patch)
treed2d40563122545c4e24ac7ac387145e5e0886bf4 /src/crypto/hash.rs
parentMerge branch 'master' of https://github.com/cjcole/rust-openssl (diff)
parentRelease v0.2.11 (diff)
downloadrust-openssl-fde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6.tar.xz
rust-openssl-fde7fbd03b0a92c2bf515c8f1fd3609b8b8745e6.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/crypto/hash.rs')
-rw-r--r--src/crypto/hash.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index 2a181526..1f8a3936 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -1,10 +1,11 @@
use libc::c_uint;
use std::ptr;
use std::io;
+use std::iter::repeat;
use ffi;
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum HashType {
MD5,
SHA1,
@@ -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())
};