Skip to content
2 changes: 1 addition & 1 deletion ascon-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

use core::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion belt-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]
#![forbid(unsafe_code)]

pub use digest::{self, Digest};
Expand Down
4 changes: 2 additions & 2 deletions blake2/src/as_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use core::mem;
use core::slice;

#[allow(clippy::missing_safety_doc)]
pub unsafe trait Safe {}
pub(crate) unsafe trait Safe {}

pub trait AsBytes {
pub(crate) trait AsBytes {
fn as_bytes(&self) -> &[u8];
}

Expand Down
6 changes: 3 additions & 3 deletions blake2/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::unreadable_literal)]

pub static SIGMA: [[usize; 16]; 12] = [
pub(crate) static SIGMA: [[usize; 16]; 12] = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
[14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3],
[11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4],
Expand All @@ -15,7 +15,7 @@ pub static SIGMA: [[usize; 16]; 12] = [
[14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3],
];

pub static BLAKE2B_IV: [u64; 8] = [
pub(crate) static BLAKE2B_IV: [u64; 8] = [
0x6a09e667f3bcc908,
0xbb67ae8584caa73b,
0x3c6ef372fe94f82b,
Expand All @@ -34,7 +34,7 @@ pub const BLAKE2B_SALTBYTES : usize = 16;
pub const BLAKE2B_PERSONALBYTES : usize = 16;
*/

pub static BLAKE2S_IV: [u32; 8] = [
pub(crate) static BLAKE2S_IV: [u32; 8] = [
0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19,
];

Expand Down
2 changes: 1 addition & 1 deletion blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(unexpected_cfgs)] // `simd` feature is broken
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]
#![cfg_attr(feature = "simd", feature(platform_intrinsics, repr_simd))]
#![cfg_attr(feature = "simd", allow(incomplete_features))]

Expand Down
4 changes: 2 additions & 2 deletions blake2/src/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ mod simdint;
mod simdop;
mod simdty;

pub use self::simdty::{u32x4, u64x4};
pub(crate) use self::simdty::{u32x4, u64x4};

pub trait Vector4<T>: Copy {
pub(crate) trait Vector4<T>: Copy {
fn gather(src: &[T], i0: usize, i1: usize, i2: usize, i3: usize) -> Self;

#[allow(clippy::wrong_self_convention)]
Expand Down
4 changes: 2 additions & 2 deletions blake2/src/simd/simd_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ pub mod u64x4;
#[cfg(not(feature = "simd"))]
macro_rules! simd_opt {
($vec:ident) => {
pub mod $vec {
pub(crate) mod $vec {
use crate::simd::simdty::$vec;

#[inline(always)]
pub fn rotate_right_const(vec: $vec, n: u32) -> $vec {
pub(crate) fn rotate_right_const(vec: $vec, n: u32) -> $vec {
$vec::new(
vec.0.rotate_right(n),
vec.1.rotate_right(n),
Expand Down
52 changes: 27 additions & 25 deletions blake2/src/simd/simdty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,24 @@ macro_rules! decl_simd {
}

decl_simd! {
pub struct Simd2<T>(pub T, pub T);
pub struct Simd4<T>(pub T, pub T, pub T, pub T);
pub struct Simd8<T>(pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T);
pub struct Simd16<T>(pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T);
pub struct Simd32<T>(pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T,
pub T, pub T, pub T, pub T);
pub(crate) struct Simd2<T>(pub(crate) T, pub(crate) T);
pub(crate) struct Simd4<T>(pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T);
pub(crate) struct Simd8<T>(pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T);

pub(crate) struct Simd16<T>(pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T);

pub(crate) struct Simd32<T>(pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T,
pub(crate) T, pub(crate) T, pub(crate) T, pub(crate) T);
}

#[cfg(feature = "zeroize")]
Expand All @@ -63,22 +65,22 @@ impl<T: Zeroize> Zeroize for Simd4<T> {
}
}

pub type u64x2 = Simd2<u64>;
pub(crate) type u64x2 = Simd2<u64>;

pub type u32x4 = Simd4<u32>;
pub type u64x4 = Simd4<u64>;
pub(crate) type u32x4 = Simd4<u32>;
pub(crate) type u64x4 = Simd4<u64>;

pub type u16x8 = Simd8<u16>;
pub type u32x8 = Simd8<u32>;
pub(crate) type u16x8 = Simd8<u16>;
pub(crate) type u32x8 = Simd8<u32>;

pub type u8x16 = Simd16<u8>;
pub type u16x16 = Simd16<u16>;
pub(crate) type u8x16 = Simd16<u8>;
pub(crate) type u16x16 = Simd16<u16>;

pub type u8x32 = Simd32<u8>;
pub(crate) type u8x32 = Simd32<u8>;

impl<T> Simd4<T> {
#[inline(always)]
pub fn new(e0: T, e1: T, e2: T, e3: T) -> Simd4<T> {
pub(crate) fn new(e0: T, e1: T, e2: T, e3: T) -> Simd4<T> {
Simd4(e0, e1, e2, e3)
}
}
Expand Down
2 changes: 1 addition & 1 deletion fsb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]
#![allow(non_snake_case)]

pub use digest::{self, Digest};
Expand Down
2 changes: 1 addition & 1 deletion gost94/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]
#![forbid(unsafe_code)]

pub use digest::{self, Digest};
Expand Down
2 changes: 1 addition & 1 deletion groestl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
2 changes: 1 addition & 1 deletion jh/src/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ union X2Bytes<M: Machine> {

#[inline(always)]
#[doc(hidden)]
pub fn f8_impl<M: Machine>(mach: M, state: &mut [vec128_storage; 8], data: *const u8) {
fn f8_impl<M: Machine>(mach: M, state: &mut [vec128_storage; 8], data: *const u8) {
#[allow(clippy::cast_ptr_alignment)]
let data: *const M::u128x1 = data.cast();
let mut y = X8::<M>(
Expand Down
2 changes: 1 addition & 1 deletion jh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
2 changes: 1 addition & 1 deletion k12/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest;

Expand Down
4 changes: 2 additions & 2 deletions kupyna/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub const MDS_MATRIX: [u64; 8] = [
pub(crate) const MDS_MATRIX: [u64; 8] = [
0x0101050108060704,
0x0401010501080607,
0x0704010105010806,
Expand All @@ -9,7 +9,7 @@ pub const MDS_MATRIX: [u64; 8] = [
0x0105010806070401,
];

pub const SBOXES: [[u8; 256]; 4] = [
pub(crate) const SBOXES: [[u8; 256]; 4] = [
[
0xa8, 0x43, 0x5f, 0x06, 0x6b, 0x75, 0x6c, 0x59, 0x71, 0xdf, 0x87, 0x95, 0x17, 0xf0, 0xd8,
0x09, 0x6d, 0xf3, 0x1d, 0xcb, 0xc9, 0x4d, 0x2c, 0xaf, 0x79, 0xe0, 0x97, 0xfd, 0x6f, 0x4b,
Expand Down
2 changes: 1 addition & 1 deletion kupyna/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
2 changes: 1 addition & 1 deletion md2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
2 changes: 1 addition & 1 deletion md4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
11 changes: 8 additions & 3 deletions md5/src/compress.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
cfg_if::cfg_if! {
if #[cfg(feature = "force-soft")] {
mod soft;
pub use soft::compress;
use soft::compress as compress_inner;
} else if #[cfg(target_arch = "loongarch64")] {
mod loongarch64_asm;
pub use loongarch64_asm::compress;
use loongarch64_asm::compress as compress_inner;
} else {
mod soft;
pub use soft::compress;
use soft::compress as compress_inner;
}
}

/// md5 compression function
pub(crate) fn compress(state: &mut [u32; 4], blocks: &[[u8; 64]]) {
compress_inner(state, blocks)
}
2 changes: 1 addition & 1 deletion md5/src/compress/loongarch64_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ macro_rules! roundtail {
}
}

pub fn compress(state: &mut [u32; 4], blocks: &[[u8; 64]]) {
pub(super) fn compress(state: &mut [u32; 4], blocks: &[[u8; 64]]) {
if blocks.is_empty() {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions md5/src/compress/soft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn op_i(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 {
}

#[inline]
pub fn compress_block(state: &mut [u32; 4], input: &[u8; 64]) {
fn compress_block(state: &mut [u32; 4], input: &[u8; 64]) {
let mut a = state[0];
let mut b = state[1];
let mut c = state[2];
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn compress_block(state: &mut [u32; 4], input: &[u8; 64]) {
}

#[inline]
pub fn compress(state: &mut [u32; 4], blocks: &[[u8; 64]]) {
pub(super) fn compress(state: &mut [u32; 4], blocks: &[[u8; 64]]) {
for block in blocks {
compress_block(state, block)
}
Expand Down
2 changes: 1 addition & 1 deletion md5/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(missing_docs)]
#![warn(missing_docs, unreachable_pub)]

pub use digest::{self, Digest};

Expand Down
10 changes: 5 additions & 5 deletions ripemd/src/c128.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use digest::typenum::U16;

pub const DIGEST_BUF_LEN: usize = 4;
pub const WORK_BUF_LEN: usize = 16;
pub type DigestBufByteLen = U16;
pub(super) const DIGEST_BUF_LEN: usize = 4;
pub(super) const WORK_BUF_LEN: usize = 16;
pub(super) type DigestBufByteLen = U16;

pub const H0: [u32; DIGEST_BUF_LEN] = [0x6745_2301, 0xefcd_ab89, 0x98ba_dcfe, 0x1032_5476];
pub(super) const H0: [u32; DIGEST_BUF_LEN] = [0x6745_2301, 0xefcd_ab89, 0x98ba_dcfe, 0x1032_5476];

macro_rules! round(
($a:expr, $b:expr, $c:expr, $d:expr,
Expand Down Expand Up @@ -90,7 +90,7 @@ macro_rules! process_block(
});
);

pub fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
pub(super) fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
let mut w = [0u32; WORK_BUF_LEN];
for (o, chunk) in w.iter_mut().zip(data.chunks_exact(4)) {
*o = u32::from_le_bytes(chunk.try_into().unwrap());
Expand Down
10 changes: 5 additions & 5 deletions ripemd/src/c160.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use digest::typenum::U20;

pub const DIGEST_BUF_LEN: usize = 5;
pub const WORK_BUF_LEN: usize = 16;
pub type DigestBufByteLen = U20;
pub(super) const DIGEST_BUF_LEN: usize = 5;
pub(super) const WORK_BUF_LEN: usize = 16;
pub(super) type DigestBufByteLen = U20;

pub const H0: [u32; DIGEST_BUF_LEN] = [
pub(super) const H0: [u32; DIGEST_BUF_LEN] = [
0x6745_2301,
0xefcd_ab89,
0x98ba_dcfe,
Expand Down Expand Up @@ -112,7 +112,7 @@ macro_rules! process_block(
});
);

pub fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
pub(super) fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
let mut w = [0u32; WORK_BUF_LEN];
for (o, chunk) in w.iter_mut().zip(data.chunks_exact(4)) {
*o = u32::from_le_bytes(chunk.try_into().unwrap());
Expand Down
12 changes: 6 additions & 6 deletions ripemd/src/c256.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use digest::typenum::U32;

pub const DIGEST_BUF_LEN: usize = 8;
pub const HALF_DIGEST_BUF_LEN: usize = DIGEST_BUF_LEN / 2;
pub const WORK_BUF_LEN: usize = 16;
pub type DigestBufByteLen = U32;
pub(super) const DIGEST_BUF_LEN: usize = 8;
pub(super) const HALF_DIGEST_BUF_LEN: usize = DIGEST_BUF_LEN / 2;
pub(super) const WORK_BUF_LEN: usize = 16;
pub(super) type DigestBufByteLen = U32;

pub const H0: [u32; DIGEST_BUF_LEN] = [
pub(super) const H0: [u32; DIGEST_BUF_LEN] = [
0x6745_2301,
0xefcd_ab89,
0x98ba_dcfe,
Expand Down Expand Up @@ -119,7 +119,7 @@ macro_rules! process_block(
});
);

pub fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
pub(super) fn compress(h: &mut [u32; DIGEST_BUF_LEN], data: &[u8; 64]) {
let mut w = [0u32; WORK_BUF_LEN];
for (o, chunk) in w.iter_mut().zip(data.chunks_exact(4)) {
*o = u32::from_le_bytes(chunk.try_into().unwrap());
Expand Down
Loading
Loading