Function aes_ecb

Source
pub fn aes_ecb(key: &[u8], data: &mut [u8], is_encrypt: bool)
Expand description

This function applies AES encryption or decryption to each block in the input data using the specified key in place. The operation is determined by the is_encrypt parameter.

§Arguments

  • key - The AES key to use for encryption or decryption. Given as a fixed-size(16B, 24B, 32B) array of bytes.
  • data - An immutable reference to a slice of bytes to process. Bytes must be a multiple of 16 bytes or 128 bits, otherwise the function will panic.
  • is_encrypt - A boolean indicating whether to encrypt (true) or decrypt (false).

§Returns

A vector of processed blocks after applying AES in ECB mode.