jisp_sha2/constants/mod.rs
1//! A collection of constant words for each of the different SHA-2 variations
2//! To use the SHA-2 algorithm with different constants you can implement the [Constants] trait
3
4/// Implement this for your constants to be used in the SHA-2 algorithm
5/// Note that the SHA-256 algorithm uses a list of 64 constant `u32` words.
6/// The SHA-512 algorithm uses a list of 80 constant `u64` words.
7pub trait Constants<const KLEN:usize, T> {
8 fn constant_words() -> [T;KLEN];
9 fn initial_hash() -> [T;8];
10}
11
12pub use sha256_constants::Sha256Constants as Sha256;
13pub use sha256_constants::Sha224Constants as Sha224;
14
15pub use sha512_constants::Sha512Constants as Sha512;
16pub use sha512_constants::Sha384Constants as Sha384;
17
18mod sha256_constants;
19mod sha512_constants;