You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-crypto-hash/0001-Upgrade-to-hex-0.3.patch

65 lines
1.7 KiB

From d47183116ab10b53703c999eb0eccc85f6e1f89d Mon Sep 17 00:00:00 2001
From: Mark Lee <crypto-hash@lazymalevolence.com>
Date: Sun, 26 Nov 2017 18:14:13 -0800
Subject: [PATCH] Upgrade to hex 0.3
(cherry picked from commit 7036d94acc843e2a03d14d7c47de352a7be411cb)
---
src/lib.rs | 3 +--
src/test.rs | 6 +++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index 3e6f6cd..7bc8e30 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -53,7 +53,6 @@ extern crate openssl;
#[cfg(target_os = "windows")]
extern crate winapi;
-use hex::ToHex;
use std::io::Write;
#[cfg(target_os = "macos")]
@@ -118,5 +117,5 @@ pub fn digest(algorithm: Algorithm, data: &[u8]) -> Vec<u8> {
/// assert_eq!(expected, result)
/// ```
pub fn hex_digest(algorithm: Algorithm, data: &[u8]) -> String {
- digest(algorithm, data).to_hex()
+ hex::encode(digest(algorithm, data))
}
diff --git a/src/test.rs b/src/test.rs
index 31920c4..2e1ef90 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -20,7 +20,7 @@
#![cfg(test)]
-use hex::ToHex;
+use hex;
use std::io::Write;
use super::{Algorithm, Hasher, hex_digest};
@@ -59,7 +59,7 @@ fn sha512_empty_string() {
#[test]
fn hasher_sans_write() {
let mut hasher = Hasher::new(Algorithm::MD5);
- let actual = hasher.finish().to_hex();
+ let actual = hex::encode(hasher.finish());
assert_eq!(MD5_EMPTY_STRING, actual)
}
@@ -69,7 +69,7 @@ fn hasher_with_write() {
hasher
.write_all(TO_HASH.as_bytes())
.expect("Could not write to hasher");
- let actual = hasher.finish().to_hex();
+ let actual = hex::encode(hasher.finish());
assert_eq!(TO_HASH_MD5, actual)
}
--
2.15.1