rs_internal_state 0.1.3

This package serves as an essential building block within the `rs_shield` cryptographic library. It is focused on providing foundational functionality and infrastructure for various cryptographic operations within the larger project. While this package has been made publicly available to satisfy the dependency requirements of Rust's cargo system, its utility is predominantly realized in the context of the `rs_shield` project. Unless you are developing or maintaining a component of the `rs_shield` project, this package might offer limited direct utility. For access to a full suite of cryptographic functionalities, consider using the `rs_shield` library bundle.
Documentation
use rs_n_bit_words::{NBitWord, TSize};

type U32Word = NBitWord<u32>;

/// Process hashing steps of SHA-224 and SHA-256
pub(crate) struct Sha256Rotor<'a, 'b>(
    pub U32Word,
    pub U32Word,
    pub U32Word,
    pub &'a mut U32Word,
    pub U32Word,
    pub U32Word,
    pub U32Word,
    pub &'b mut U32Word,
    pub U32Word,
);

impl Sha256Rotor<'_, '_> {
    #[inline(always)]
    pub fn rnd(&mut self, k: u32) {
        let t0 = self.4.sigma1() + U32Word::ch(self.4, self.5, self.6) + *self.7 + self.8 + k;
        *self.3 += t0;
        *self.7 = t0 + self.0.sigma0() + U32Word::maj(self.0, self.1, self.2);
    }
}