parent
0d9e26833a
commit
680d3f20eb
@ -1,2 +1,3 @@
|
|||||||
/md-5-0.8.0.crate
|
/md-5-0.8.0.crate
|
||||||
/md-5-0.9.0.crate
|
/md-5-0.9.0.crate
|
||||||
|
/md-5-0.9.1.crate
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
From d24f26b1650156b1da4fced389559cee17805910 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artyom Pavlov <newpavlov@gmail.com>
|
|
||||||
Date: Wed, 10 Jun 2020 20:11:36 +0300
|
|
||||||
Subject: [PATCH] Update block-buffer to v0.9 (#164)
|
|
||||||
|
|
||||||
---
|
|
||||||
src/lib.rs | 15 +++++++--------
|
|
||||||
src/utils.rs | 7 ++++---
|
|
||||||
2 files changed, 11 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/lib.rs b/src/lib.rs
|
|
||||||
index fce2081..3a02898 100644
|
|
||||||
--- a/src/lib.rs
|
|
||||||
+++ b/src/lib.rs
|
|
||||||
@@ -44,7 +44,6 @@ pub use digest::{self, Digest};
|
|
||||||
|
|
||||||
use crate::utils::compress;
|
|
||||||
|
|
||||||
-use block_buffer::byteorder::{ByteOrder, LE};
|
|
||||||
use block_buffer::BlockBuffer;
|
|
||||||
use digest::generic_array::typenum::{U16, U64};
|
|
||||||
use digest::generic_array::GenericArray;
|
|
||||||
@@ -82,10 +81,9 @@ fn convert(d: &GenericArray<u8, U64>) -> &[u8; 64] {
|
|
||||||
impl Md5 {
|
|
||||||
#[inline]
|
|
||||||
fn finalize_inner(&mut self) {
|
|
||||||
- let state = &mut self.state;
|
|
||||||
+ let s = &mut self.state;
|
|
||||||
let l = (self.length_bytes << 3) as u64;
|
|
||||||
- self.buffer
|
|
||||||
- .len64_padding::<LE, _>(l, |d| compress(state, convert(d)));
|
|
||||||
+ self.buffer.len64_padding_le(l, |d| compress(s, convert(d)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -100,9 +98,8 @@ impl Update for Md5 {
|
|
||||||
// Unlike Sha1 and Sha2, the length value in MD5 is defined as
|
|
||||||
// the length of the message mod 2^64 - ie: integer overflow is OK.
|
|
||||||
self.length_bytes = self.length_bytes.wrapping_add(input.len() as u64);
|
|
||||||
- let self_state = &mut self.state;
|
|
||||||
- self.buffer
|
|
||||||
- .input(input, |d| compress(self_state, convert(d)));
|
|
||||||
+ let s = &mut self.state;
|
|
||||||
+ self.buffer.input_block(input, |d| compress(s, convert(d)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -112,7 +109,9 @@ impl FixedOutputDirty for Md5 {
|
|
||||||
#[inline]
|
|
||||||
fn finalize_into_dirty(&mut self, out: &mut GenericArray<u8, U16>) {
|
|
||||||
self.finalize_inner();
|
|
||||||
- LE::write_u32_into(&self.state, out);
|
|
||||||
+ for (chunk, v) in out.chunks_exact_mut(4).zip(self.state.iter()) {
|
|
||||||
+ chunk.copy_from_slice(&v.to_le_bytes());
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/utils.rs b/src/utils.rs
|
|
||||||
index 8a946e7..9cd0259 100644
|
|
||||||
--- a/src/utils.rs
|
|
||||||
+++ b/src/utils.rs
|
|
||||||
@@ -1,7 +1,6 @@
|
|
||||||
#![allow(clippy::many_single_char_names)]
|
|
||||||
-
|
|
||||||
use crate::consts::RC;
|
|
||||||
-use block_buffer::byteorder::{ByteOrder, LE};
|
|
||||||
+use core::convert::TryInto;
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
fn op_f(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 {
|
|
||||||
@@ -50,7 +49,9 @@ pub fn compress(state: &mut [u32; 4], input: &[u8; 64]) {
|
|
||||||
let mut d = state[3];
|
|
||||||
|
|
||||||
let mut data = [0u32; 16];
|
|
||||||
- LE::read_u32_into(input, &mut data);
|
|
||||||
+ for (o, chunk) in data.iter_mut().zip(input.chunks_exact(4)) {
|
|
||||||
+ *o = u32::from_le_bytes(chunk.try_into().unwrap());
|
|
||||||
+ }
|
|
||||||
|
|
||||||
// round 1
|
|
||||||
a = op_f(a, b, c, d, data[0], RC[0], 7);
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
--- md-5-0.9.0/Cargo.toml 2020-06-10T02:13:43+00:00
|
|
||||||
+++ md-5-0.9.0/Cargo.toml 2020-06-21T15:38:18.674929+00:00
|
|
||||||
@@ -26,7 +26,7 @@
|
|
||||||
[lib]
|
|
||||||
name = "md5"
|
|
||||||
[dependencies.block-buffer]
|
|
||||||
-version = "0.8"
|
|
||||||
+version = "0.9"
|
|
||||||
|
|
||||||
[dependencies.digest]
|
|
||||||
version = "0.9"
|
|
@ -1 +1 @@
|
|||||||
SHA512 (md-5-0.9.0.crate) = 0d9adf778f78ee83dab2b30b282682350e93018c268f9eda4ebb846d0c1ea5ca54b6702a6bf0efe9d77634b50bc6cd515f4c0debcb956f2da07fa28fe94c1b53
|
SHA512 (md-5-0.9.1.crate) = 300723a785c7edad2a9abf18fd9f8f9a40ba54676b394cb5712894d1170cc48199a0ca9ccd3b525f82832d5b33413c2565a0c079b6dd08c63d782f1a91fc3e0b
|
||||||
|
Loading…
Reference in new issue