Skip to main content

transpose

Function transpose 

Source
pub fn transpose(input: &u8x4x4) -> u8x4x4
Expand description

Transpose a 4x4 state matrix, used in many blcok ciphers.

use eva_crypto::generic::transpose;
assert_eq!(
    transpose(&[
        [0x1, 0x2, 0x3, 0x4],
        [0x0, 0x0, 0x0, 0x0],
        [0x0, 0x0, 0x0, 0x0],
        [0x0, 0x0, 0x0, 0x0],
    ]),
    [
        [0x1, 0x0, 0x0, 0x0],
        [0x2, 0x0, 0x0, 0x0],
        [0x3, 0x0, 0x0, 0x0],
        [0x4, 0x0, 0x0, 0x0],
    ]
);