const_siphasher/
lib.rs

1#![doc = include_str!("../README.md")]
2#![cfg_attr(not(test), no_std)]
3#![allow(clippy::unreadable_literal)]
4#![allow(clippy::cast_lossless)]
5#![allow(clippy::many_single_char_names)]
6
7pub mod sip;
8pub mod sip128;
9
10#[cfg(test)]
11mod tests;
12
13#[cfg(test)]
14mod tests128;
15
16#[doc(hidden)]
17trait Sip {
18    const C_ROUNDS: usize;
19    const D_ROUNDS: usize;
20}
21
22#[derive(Debug, Clone, Copy, Default)]
23struct Sip13Rounds;
24
25impl Sip for Sip13Rounds {
26    const C_ROUNDS: usize = 1;
27    const D_ROUNDS: usize = 3;
28}
29
30#[derive(Debug, Clone, Copy, Default)]
31struct Sip24Rounds;
32
33impl Sip for Sip24Rounds {
34    const C_ROUNDS: usize = 2;
35    const D_ROUNDS: usize = 4;
36}
37
38#[cfg(any(feature = "serde", feature = "serde_std", feature = "serde_no_std"))]
39pub mod reexports {
40    pub use serde;
41    #[cfg(feature = "serde_json")]
42    pub use serde_json;
43}
44
45pub mod prelude {
46    pub use core::hash::Hasher as _;
47
48    pub use sip128::Hasher128 as _;
49
50    pub use crate::{sip, sip128};
51}