scsys_crypto/hash/
mod.rs

1/*
2    Appellation: hash <module>
3    Contrib: @FL03
4*/
5//! this implements various hashing primitives and utilities for cryptographic operations.
6//!
7//! ## Features
8//!
9//! - [`blake3`](https://docs.rs/blake3/latest/blake3/index.html): enables the `blake3` hashing algorithm.
10#[doc(inline)]
11pub use self::{h160::H160, h256::H256, traits::prelude::*, types::prelude::*};
12
13/// this modules implements the [`H160`] type, which is a 20-byte hash output.
14pub mod h160;
15/// this modules implements the [`H256`] type, which is a 32-byte hash output.
16pub mod h256;
17
18pub mod traits {
19    //! this module defines various traits for the [`hash`](crate::hash) module.
20    #[doc(inline)]
21    pub use self::prelude::*;
22
23    pub mod hash;
24    pub mod hasher;
25    pub mod raw_hash;
26
27    pub(crate) mod prelude {
28        #[doc(inline)]
29        pub use super::hash::*;
30        #[doc(inline)]
31        pub use super::hasher::*;
32        #[doc(inline)]
33        pub use super::raw_hash::*;
34    }
35}
36
37pub mod types {
38    //! this module defines additional types for the [`hash`](crate::hash) module.
39    #[doc(inline)]
40    pub use self::prelude::*;
41
42    pub(crate) mod prelude {
43        #[doc(inline)]
44        pub use super::aliases::*;
45    }
46
47    pub(crate) mod aliases {
48        use generic_array::GenericArray;
49        use typenum::{B0, B1, UInt, UTerm};
50        /// a type alias for a generic hash output
51        pub type GenericHashOutput =
52            UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>;
53        /// the [GenericHash] type alias defines a standard hash format for the crate
54        pub type GenericHash<T = u8, Output = GenericHashOutput> = GenericArray<T, Output>;
55    }
56}
57
58pub(crate) mod prelude {
59    #[doc(inline)]
60    pub use super::h160::*;
61    #[doc(inline)]
62    pub use super::h256::*;
63    #[doc(inline)]
64    pub use super::traits::prelude::*;
65    #[doc(inline)]
66    pub use super::types::prelude::*;
67}