Skip to content

Commit

Permalink
fix whirlpool, remove TryInto imports
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jan 10, 2024
1 parent 5a274e1 commit f32bee5
Show file tree
Hide file tree
Showing 20 changed files with 9 additions and 25 deletions.
2 changes: 1 addition & 1 deletion blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern crate std;

pub use digest::{self, Digest};

use core::{convert::TryInto, fmt, marker::PhantomData, ops::Div};
use core::{fmt, marker::PhantomData, ops::Div};
use digest::{
array::{Array, ArraySize},
block_buffer::{Lazy, LazyBuffer},
Expand Down
2 changes: 1 addition & 1 deletion gost94/src/gost94_core.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::many_single_char_names)]
use core::{convert::TryInto, fmt};
use core::fmt;
use digest::{
block_buffer::Eager,
core_api::{
Expand Down
1 change: 0 additions & 1 deletion groestl/src/compress1024.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::needless_range_loop)]
use crate::table::TABLE;
use core::{convert::TryInto, u64};

pub(crate) const COLS: usize = 16;
const ROUNDS: u64 = 14;
Expand Down
1 change: 0 additions & 1 deletion groestl/src/compress512.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::needless_range_loop)]
use crate::table::TABLE;
use core::{convert::TryInto, u64};

pub(crate) const COLS: usize = 8;
const ROUNDS: u64 = 10;
Expand Down
2 changes: 1 addition & 1 deletion md4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

pub use digest::{self, Digest};

use core::{convert::TryInto, fmt, num::Wrapping as W};
use core::{fmt, num::Wrapping as W};
#[cfg(feature = "oid")]
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
use digest::{
Expand Down
1 change: 0 additions & 1 deletion md5/src/compress/soft.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::many_single_char_names, clippy::unreadable_literal)]
use crate::consts::RC;
use core::convert::TryInto;

#[inline(always)]
fn op_f(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 {
Expand Down
2 changes: 0 additions & 2 deletions ripemd/src/c128.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryInto;

pub const DIGEST_BUF_LEN: usize = 4;
pub const WORK_BUF_LEN: usize = 16;

Expand Down
2 changes: 0 additions & 2 deletions ripemd/src/c160.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryInto;

pub const DIGEST_BUF_LEN: usize = 5;
pub const WORK_BUF_LEN: usize = 16;

Expand Down
2 changes: 1 addition & 1 deletion ripemd/src/c256.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{convert::TryInto, mem::swap};
use core::mem::swap;

pub const DIGEST_BUF_LEN: usize = 8;
pub const HALF_DIGEST_BUF_LEN: usize = DIGEST_BUF_LEN / 2;
Expand Down
2 changes: 1 addition & 1 deletion ripemd/src/c320.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{convert::TryInto, mem::swap};
use core::mem::swap;

pub const HALF_DIGEST_BUF_LEN: usize = 5;
pub const DIGEST_BUF_LEN: usize = 10;
Expand Down
1 change: 0 additions & 1 deletion sha1/src/compress/soft.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::many_single_char_names)]
use super::BLOCK_SIZE;
use core::convert::TryInto;

const K: [u32; 4] = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6];

Expand Down
1 change: 0 additions & 1 deletion sha2/src/sha256/soft.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::many_single_char_names)]
use crate::consts::BLOCK_LEN;
use core::convert::TryInto;

#[inline(always)]
fn shr(v: [u32; 4], o: u32) -> [u32; 4] {
Expand Down
1 change: 0 additions & 1 deletion sha2/src/sha512/soft.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::many_single_char_names)]
use crate::consts::{BLOCK_LEN, K64X2};
use core::convert::TryInto;

fn add(a: [u64; 2], b: [u64; 2]) -> [u64; 2] {
[a[0].wrapping_add(b[0]), a[1].wrapping_add(b[1])]
Expand Down
1 change: 0 additions & 1 deletion sha3/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::convert::TryInto;
#[cfg(feature = "zeroize")]
use zeroize::{Zeroize, ZeroizeOnDrop};

Expand Down
2 changes: 1 addition & 1 deletion sha3/tests/turboshake.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{convert::TryInto, fmt::Debug};
use core::fmt::Debug;
use digest::ExtendableOutput;

pub(crate) fn turbo_shake_test<D, F>(
Expand Down
2 changes: 1 addition & 1 deletion shabal/src/core_api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::consts;
use core::{convert::TryInto, fmt, mem, num::Wrapping};
use core::{fmt, mem, num::Wrapping};
use digest::{
array::Array,
block_buffer::Eager,
Expand Down
1 change: 0 additions & 1 deletion sm3/src/compress.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::many_single_char_names, clippy::too_many_arguments)]
use crate::{consts::T32, Block, Sm3Core};
use core::convert::TryInto;

#[inline(always)]
fn ff1(x: u32, y: u32, z: u32) -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion streebog/src/core_api.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{convert::TryInto, fmt};
use core::fmt;
use digest::{
block_buffer::Eager,
consts::U64,
Expand Down
1 change: 0 additions & 1 deletion tiger/src/compress.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::tables::{T1, T2, T3, T4};
use super::State;
use core::convert::TryInto;

#[inline(always)]
fn round(a: &mut u64, b: &mut u64, c: &mut u64, x: &u64, mul: u8) {
Expand Down
5 changes: 1 addition & 4 deletions whirlpool/src/compress.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use crate::BLOCK_SIZE;
use core::convert::TryInto;

#[path = "consts.rs"]
mod consts;
use consts::*;

fn compress_block(state: &mut [u64; 8], b: &[u8; BLOCK_SIZE]) {
fn compress_block(state: &mut [u64; 8], b: &[u8; 64]) {
let mut k = [0u64; 8];
let mut block = [0u64; 8];
let mut s = [0u64; 8];
Expand Down

0 comments on commit f32bee5

Please sign in to comment.