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, Rotate, TSize};

pub struct Sha160Rotor<'a, 'b, 'c, 'd, 'e, 'f>(
    pub &'a NBitWord<u32>,
    pub &'b mut NBitWord<u32>,
    pub &'c NBitWord<u32>,
    pub &'d NBitWord<u32>,
    pub &'e mut NBitWord<u32>,
    pub &'f NBitWord<u32>,
);

impl Sha160Rotor<'_, '_, '_, '_, '_, '_> {
    pub const T_00_19: u32 = 0x5A827999;
    pub const T_20_39: u32 = 0x6ED9EBA1;
    pub const T_40_59: u32 = 0x8F1BBCDC;
    pub const T_60_79: u32 = 0xCA62C1D6;
}

impl Sha160Rotor<'_, '_, '_, '_, '_, '_> {
    pub fn rounds_00_19(&mut self) {
        *self.4 += *self.5 + Self::T_00_19 + self.0.rotate_left(5) + NBitWord::<u32>::ch(*self.1, *self.2, *self.3);
        *self.1 = self.1.rotate_right(2);
    }

    pub fn rounds_20_39(&mut self) {
        *self.4 += *self.5 + Self::T_20_39 + self.0.rotate_left(5) + NBitWord::<u32>::parity(*self.1, *self.2, *self.3);
        *self.1 = self.1.rotate_right(2);
    }

    pub fn rounds_40_59(&mut self) {
        *self.4 += *self.5 + Self::T_40_59 + self.0.rotate_left(5) + NBitWord::<u32>::maj(*self.1, *self.2, *self.3);
        *self.1 = self.1.rotate_right(2);
    }

    pub fn rounds_60_79(&mut self) {
        *self.4 += *self.5 + Self::T_60_79 + self.0.rotate_left(5) + NBitWord::<u32>::parity(*self.1, *self.2, *self.3);
        *self.1 = self.1.rotate_right(2);
    }
}