Replaces the depracted rustc_serialize with hex

This commit is contained in:
Zaki Manian 2017-06-23 15:42:58 -07:00 committed by Isis Lovecruft
parent a1caa4dfda
commit 8accff36b3
Failed to extract signature
3 changed files with 8 additions and 8 deletions

View file

@ -38,7 +38,7 @@ version = "^0.6"
version = "^0.8" version = "^0.8"
[dev-dependencies] [dev-dependencies]
rustc-serialize = "0.3" hex = "0.2"
sha2 = "^0.6" sha2 = "^0.6"
[features] [features]

View file

@ -495,7 +495,7 @@ mod test {
use std::vec::Vec; use std::vec::Vec;
use curve25519_dalek::edwards::ExtendedPoint; use curve25519_dalek::edwards::ExtendedPoint;
use rand::OsRng; use rand::OsRng;
use rustc_serialize::hex::FromHex; use hex::FromHex;
use sha2::Sha512; use sha2::Sha512;
use super::*; use super::*;
@ -573,14 +573,14 @@ mod test {
let parts: Vec<&str> = line.split(':').collect(); let parts: Vec<&str> = line.split(':').collect();
assert_eq!(parts.len(), 5, "wrong number of fields in line {}", lineno); assert_eq!(parts.len(), 5, "wrong number of fields in line {}", lineno);
let sec_bytes: &[u8] = &parts[0].from_hex().unwrap(); let sec_bytes: Vec<u8>= FromHex::from_hex(&parts[0]).unwrap();
let pub_bytes: &[u8] = &parts[1].from_hex().unwrap(); let pub_bytes: Vec<u8> = FromHex::from_hex(&parts[1]).unwrap();
let message: &[u8] = &parts[2].from_hex().unwrap(); let message: Vec<u8> = FromHex::from_hex(&parts[2]).unwrap();
let sig_bytes: &[u8] = &parts[3].from_hex().unwrap(); let sig_bytes: Vec<u8> = FromHex::from_hex(&parts[3]).unwrap();
// The signatures in the test vectors also include the message // The signatures in the test vectors also include the message
// at the end, but we just want R and S. // at the end, but we just want R and S.
let sig1: Signature = Signature::from_bytes(sig_bytes); let sig1: Signature = Signature::from_bytes(sig_bytes.as_ref());
let keypair: Keypair = Keypair::from_bytes( let keypair: Keypair = Keypair::from_bytes(
array_ref!(*pub_bytes, 0, PUBLIC_KEY_LENGTH), array_ref!(*pub_bytes, 0, PUBLIC_KEY_LENGTH),

View file

@ -128,7 +128,7 @@ extern crate std;
extern crate sha2; extern crate sha2;
#[cfg(test)] #[cfg(test)]
extern crate rustc_serialize; extern crate hex;
#[cfg(all(test, feature = "bench"))] #[cfg(all(test, feature = "bench"))]
extern crate test; extern crate test;