aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/hash.rs
diff options
context:
space:
mode:
authorBastien Orivel <[email protected]>2018-01-01 17:38:38 +0100
committerBastien Orivel <[email protected]>2018-01-01 17:38:38 +0100
commitbb5ab2b43f4346c411a087258a8e76788b9f5101 (patch)
tree0413df33f9bc1e486e9c98b5b8e7c22807a155bf /openssl/src/hash.rs
parentMerge pull request #810 from sfackler/key-tag (diff)
downloadrust-openssl-bb5ab2b43f4346c411a087258a8e76788b9f5101.tar.xz
rust-openssl-bb5ab2b43f4346c411a087258a8e76788b9f5101.zip
Bump hex to 0.3
The `to_hex` method has been removed and `hex::encode` should be used instead.
Diffstat (limited to 'openssl/src/hash.rs')
-rw-r--r--openssl/src/hash.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/openssl/src/hash.rs b/openssl/src/hash.rs
index 9ceaebbc..103a7ae3 100644
--- a/openssl/src/hash.rs
+++ b/openssl/src/hash.rs
@@ -265,20 +265,20 @@ pub fn hash(t: MessageDigest, data: &[u8]) -> Result<DigestBytes, ErrorStack> {
#[cfg(test)]
mod tests {
- use hex::{FromHex, ToHex};
+ use hex::{self, FromHex};
use std::io::prelude::*;
use super::*;
fn hash_test(hashtype: MessageDigest, hashtest: &(&str, &str)) {
let res = hash(hashtype, &Vec::from_hex(hashtest.0).unwrap()).unwrap();
- assert_eq!(res.to_hex(), hashtest.1);
+ assert_eq!(hex::encode(res), hashtest.1);
}
fn hash_recycle_test(h: &mut Hasher, hashtest: &(&str, &str)) {
let _ = h.write_all(&Vec::from_hex(hashtest.0).unwrap()).unwrap();
let res = h.finish().unwrap();
- assert_eq!(res.to_hex(), hashtest.1);
+ assert_eq!(hex::encode(res), hashtest.1);
}
// Test vectors from http://www.nsrl.nist.gov/testdata/
@@ -344,18 +344,18 @@ mod tests {
let mut h2 = h1.clone();
h2.write_all(&inp[p..]).unwrap();
let res = h2.finish().unwrap();
- assert_eq!(res.to_hex(), md5_tests[i].1);
+ assert_eq!(hex::encode(res), md5_tests[i].1);
}
h1.write_all(&inp[p..]).unwrap();
let res = h1.finish().unwrap();
- assert_eq!(res.to_hex(), md5_tests[i].1);
+ assert_eq!(hex::encode(res), md5_tests[i].1);
println!("Clone a finished hasher");
let mut h3 = h1.clone();
h3.write_all(&Vec::from_hex(md5_tests[i + 1].0).unwrap())
.unwrap();
let res = h3.finish().unwrap();
- assert_eq!(res.to_hex(), md5_tests[i + 1].1);
+ assert_eq!(hex::encode(res), md5_tests[i + 1].1);
}
#[test]