From e8602a12826ab08a0facaf97c6ff5681ad6d518b Mon Sep 17 00:00:00 2001 From: brycx Date: Wed, 22 Aug 2018 11:16:26 +0200 Subject: [PATCH] Replace byte-tools with byteorder crate as byte-tools no longer offers the rquired functionality --- Cargo.toml | 2 +- src/hazardous/cshake.rs | 4 ++-- src/hazardous/pbkdf2.rs | 4 ++-- src/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dcf4cc4c..4de69360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ exclude = [ rand = "0.5.5" sha2 = "0.7.1" tiny-keccak = "1.4.2" -byte-tools = "0.2.0" +byteorder = "1.2.4" subtle = "0.7.0" seckey = "0.9.1" diff --git a/src/hazardous/cshake.rs b/src/hazardous/cshake.rs index fb551e57..09d4977c 100644 --- a/src/hazardous/cshake.rs +++ b/src/hazardous/cshake.rs @@ -40,7 +40,7 @@ //! //! hash.finalize(&mut out).unwrap(); //! ``` -use byte_tools::write_u64_be; +use byteorder::{ByteOrder, BigEndian}; use core::mem; use tiny_keccak::Keccak; use utilities::errors::*; @@ -173,7 +173,7 @@ fn left_encode(x: u64) -> ([u8; 9], usize) { if x == 0 { offset = 8; } else { - write_u64_be(&mut input[1..], x.to_le()); + BigEndian::write_u64(&mut input[1..], x.to_le()); for idx in &input { if *idx != 0 { break; diff --git a/src/hazardous/pbkdf2.rs b/src/hazardous/pbkdf2.rs index ae64d3e5..4bb3d4fa 100644 --- a/src/hazardous/pbkdf2.rs +++ b/src/hazardous/pbkdf2.rs @@ -64,7 +64,7 @@ //! assert!(pbkdf2::verify(&exp_dk, "Secret password".as_bytes(), &salt, 10000, &mut dk_out).unwrap()); //! ``` -use byte_tools::write_u32_be; +use byteorder::{ByteOrder, BigEndian}; use hazardous::constants::{HLenArray, HLEN}; use hazardous::hmac; use utilities::{errors::*, util}; @@ -81,7 +81,7 @@ fn function_f( let mut u_step: HLenArray = [0u8; 64]; // First 4 bytes used for index BE conversion - write_u32_be(&mut u_step[..4], index as u32); + BigEndian::write_u32(&mut u_step[..4], index as u32); hmac.update(salt); hmac.update(&u_step[..4]); diff --git a/src/lib.rs b/src/lib.rs index 7bf4adda..eead6160 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ #![no_std] #![forbid(warnings, unsafe_code)] -extern crate byte_tools; +extern crate byteorder; extern crate rand; extern crate seckey; extern crate sha2;