pub(crate) fn new(key: &[u8; KEY_SIZE], iv: [u8; IV_SIZE]) -> Self {
        #[allow(unsafe_code)]
        let mut state: [u32; STATE_WORDS] = unsafe { mem::zeroed() };
        state[0] = CONSTANTS[0];

        for (i, chunk) in key[..16].chunks(4).enumerate() {
            state[1 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }

        state[5] = CONSTANTS[1];

        for (i, chunk) in iv.chunks(4).enumerate() {
            state[6 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }

        state[8] = 0;
        state[9] = 0;
        state[10] = CONSTANTS[2];

        for (i, chunk) in key[16..].chunks(4).enumerate() {
            state[11 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }

        state[15] = CONSTANTS[3];

        Self {
            state,
            rounds: PhantomData,
        }
    }
/// Initialize block function with the given key and IV
Initialize block function with the given key and IV
Initialize block function with the given key and IV
pub(crate) fn new(key: &[u8; KEY_SIZE], iv: [u8; IV_SIZE]) -> Self {
        #[allow(unsafe_code)]
        let mut state: [u32; STATE_WORDS] = unsafe { mem::zeroed() };
        state[0] = CONSTANTS[0];
        for (i, chunk) in key[..16].chunks(4).enumerate() {
            state[1 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }
        state[5] = CONSTANTS[1];
        for (i, chunk) in iv.chunks(4).enumerate() {
            state[6 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }
        state[8] = 0;
        state[9] = 0;
        state[10] = CONSTANTS[2];
        for (i, chunk) in key[16..].chunks(4).enumerate() {
            state[11 + i] = u32::from_le_bytes(chunk.try_into().unwrap());
        }
        state[15] = CONSTANTS[3];
        Self {
            state,
            rounds: PhantomData,
        }
    }
pub ( crate ) fn new ( key : & [ u8 ; KEY_SIZE ] , iv : [ u8 ; IV_SIZE ] ) -> Self { # [ allow ( unsafe_code ) ] let mut state : [ u32 ; STATE_WORDS ] = unsafe { mem :: zeroed ( ) } ; state [ 0 ] = CONSTANTS [ 0 ] ; for ( i , chunk ) in key [ .. 16 ] . chunks ( 4 ) . enumerate ( ) { state [ 1 + i ] = u32 :: from_le_bytes ( chunk . try_into ( ) . unwrap ( ) ) ; } state [ 5 ] = CONSTANTS [ 1 ] ; for ( i , chunk ) in iv . chunks ( 4 ) . enumerate ( ) { state [ 6 + i ] = u32 :: from_le_bytes ( chunk . try_into ( ) . unwrap ( ) ) ; } state [ 8 ] = 0 ; state [ 9 ] = 0 ; state [ 10 ] = CONSTANTS [ 2 ] ; for ( i , chunk ) in key [ 16 .. ] . chunks ( 4 ) . enumerate ( ) { state [ 11 + i ] = u32 :: from_le_bytes ( chunk . try_into ( ) . unwrap ( ) ) ; } state [ 15 ] = CONSTANTS [ 3 ] ; Self { state , rounds : PhantomData , } }
Initialize block function with the given key and IV
Initialize block function with the given key and IV
key
&[u8; KEY_SIZE]
iv
[u8; IV_SIZE]