Skip to main content

Word

Trait Word 

Source
pub(crate) trait Word:
    Sized
    + Copy
    + Default
    + 'static
    + BitAnd<Output = Self>
    + BitAndAssign
    + BitOr<Output = Self>
    + BitOrAssign
    + BitXor<Output = Self>
    + BitXorAssign
    + Not<Output = Self>
    + Shl<u32, Output = Self>
    + Shr<u32, Output = Self> {
    type Blocks: ArraySize;

    const ROW_BITS: u32 = _;
    const HALF_ROW: u32 = _;
    const QUARTER_ROW: u32 = _;

    // Required methods
    fn ror(self, n: u32) -> Self;
    fn uniform_row(b: u8) -> Self;
    fn pack_rows(r0: u8, r1: u8, r2: u8, r3: u8) -> Self;
    fn byte_repeat(b: u8) -> Self;
    fn bitslice(output: &mut [Self], input: &Array<Block, Self::Blocks>);
    fn inv_bitslice(input: &[Self]) -> Array<Block, Self::Blocks>;

    // Provided method
    fn ror_distance(rows: u32, cols: u32) -> u32 { ... }
}
Expand description

Width-abstracted machine word holding one row of a bitsliced AES state.

Provided Associated Constants§

Source

const ROW_BITS: u32 = _

Width in bits of one row of the bitsliced state (8 for u32, 16 for u64).

Source

const HALF_ROW: u32 = _

Half of ROW_BITS.

Source

const QUARTER_ROW: u32 = _

Quarter of ROW_BITS.

Required Associated Types§

Source

type Blocks: ArraySize

Number of 128-bit blocks bitsliced together in one state.

Required Methods§

Source

fn ror(self, n: u32) -> Self

Rotate right by n bits.

Source

fn uniform_row(b: u8) -> Self

Pack the same byte across all 4 rows of the word.

Source

fn pack_rows(r0: u8, r1: u8, r2: u8, r3: u8) -> Self

Place one byte at each of the 4 row positions of the word (row 0 = LSB).

Source

fn byte_repeat(b: u8) -> Self

Replicate byte b across every byte of the word.

Source

fn bitslice(output: &mut [Self], input: &Array<Block, Self::Blocks>)

Pack Self::Blocks input blocks into a bitsliced 8-row state slice.

Source

fn inv_bitslice(input: &[Self]) -> Array<Block, Self::Blocks>

Unpack a bitsliced 8-row state slice into Self::Blocks output blocks.

Provided Methods§

Source

fn ror_distance(rows: u32, cols: u32) -> u32

Distance in bits to rotate a state row by (rows, cols) positions.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Word for u32

Source§

fn bitslice(output: &mut [u32], input: &Array<Block, U2>)

Bitslice two 128-bit input blocks into a 256-bit internal state.

Source§

fn inv_bitslice(input: &[u32]) -> Array<Block, U2>

Un-bitslice a 256-bit internal state into two 128-bit blocks.

Source§

type Blocks = UInt<UInt<UTerm, B1>, B0>

Source§

fn ror(self, n: u32) -> u32

Source§

fn uniform_row(b: u8) -> u32

Source§

fn pack_rows(r0: u8, r1: u8, r2: u8, r3: u8) -> u32

Source§

fn byte_repeat(b: u8) -> u32

Source§

impl Word for u64

Source§

fn bitslice(output: &mut [u64], input: &Array<Block, U4>)

Bitslice four 128-bit input blocks into a 512-bit internal state.

Source§

fn inv_bitslice(input: &[u64]) -> Array<Block, U4>

Un-bitslice a 512-bit internal state into four 128-bit blocks.

Source§

type Blocks = UInt<UInt<UInt<UTerm, B1>, B0>, B0>

Source§

fn ror(self, n: u32) -> u64

Source§

fn uniform_row(b: u8) -> u64

Source§

fn pack_rows(r0: u8, r1: u8, r2: u8, r3: u8) -> u64

Source§

fn byte_repeat(b: u8) -> u64

Implementors§