Skip to content

Commit

Permalink
Updates to remove hybrid_array::ArrayOps
Browse files Browse the repository at this point in the history
This was a breaking change: RustCrypto/hybrid-array#30

This PR includes the necessary updates to remain compatible.
  • Loading branch information
tarcieri committed Jan 28, 2024
1 parent 7de22e5 commit 1141bc4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ members = [

[profile.dev]
opt-level = 2

[patch.crates-io.hybrid-array]
git = "https://github.com/RustCrypto/hybrid-array.git"
4 changes: 2 additions & 2 deletions md5/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) mod consts;

use core::{fmt, slice::from_ref};
use digest::{
array::ArrayOps,
array::Array,
block_buffer::Eager,
core_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper, FixedOutputCore,
Expand Down Expand Up @@ -57,7 +57,7 @@ impl UpdateCore for Md5Core {
#[inline]
fn update_blocks(&mut self, blocks: &[Block<Self>]) {
self.block_len = self.block_len.wrapping_add(blocks.len() as u64);
let blocks = ArrayOps::cast_slice_to_core(blocks);
let blocks = Array::cast_slice_to_core(blocks);
compress::compress(&mut self.state, blocks)
}
}
Expand Down
4 changes: 2 additions & 2 deletions sha1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub use digest::{self, Digest};

use core::{fmt, slice::from_ref};
use digest::{
array::ArrayOps,
array::Array,
block_buffer::Eager,
core_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper, FixedOutputCore,
Expand Down Expand Up @@ -61,7 +61,7 @@ impl UpdateCore for Sha1Core {
#[inline]
fn update_blocks(&mut self, blocks: &[Block<Self>]) {
self.block_len += blocks.len() as u64;
let blocks = ArrayOps::cast_slice_to_core(blocks);
let blocks = Array::cast_slice_to_core(blocks);
compress(&mut self.h, blocks);
}
}
Expand Down
6 changes: 3 additions & 3 deletions sha2/src/core_api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{consts, sha256::compress256, sha512::compress512};
use core::{fmt, slice::from_ref};
use digest::{
array::ArrayOps,
array::Array,
block_buffer::Eager,
core_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, OutputSizeUser, TruncSide,
Expand Down Expand Up @@ -38,7 +38,7 @@ impl UpdateCore for Sha256VarCore {
#[inline]
fn update_blocks(&mut self, blocks: &[Block<Self>]) {
self.block_len += blocks.len() as u64;
let blocks = ArrayOps::cast_slice_to_core(blocks);
let blocks = Array::cast_slice_to_core(blocks);
compress256(&mut self.state, blocks);
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ impl UpdateCore for Sha512VarCore {
#[inline]
fn update_blocks(&mut self, blocks: &[Block<Self>]) {
self.block_len += blocks.len() as u128;
let blocks = ArrayOps::cast_slice_to_core(blocks);
let blocks = Array::cast_slice_to_core(blocks);
compress512(&mut self.state, blocks);
}
}
Expand Down
4 changes: 2 additions & 2 deletions whirlpool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use digest::{self, Digest};

use core::fmt;
use digest::{
array::ArrayOps,
array::Array,
block_buffer::Eager,
core_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper, FixedOutputCore,
Expand Down Expand Up @@ -59,7 +59,7 @@ impl UpdateCore for WhirlpoolCore {
fn update_blocks(&mut self, blocks: &[Block<Self>]) {
let block_bits = 8 * Self::block_size() as u64;
self.update_len(block_bits * (blocks.len() as u64));
let blocks = ArrayOps::cast_slice_to_core(blocks);
let blocks = Array::cast_slice_to_core(blocks);
compress(&mut self.state, blocks);
}
}
Expand Down

0 comments on commit 1141bc4

Please sign in to comment.