Skip to main content

Module encrypter

Module encrypter 

Source
Expand description

REX Encrypter

This module defines the full encryption pipeline for WHY2, including Grid shaping and round-based mixing. It transforms raw data into encrypted Grid chunks using a symmetric key.

§Overview

WHY2 encrypts data by converting it into fixed-size grids (Grid) and applying nonlinear and linear transformations across multiple rounds in CTR mode. The process includes:

  1. Grid Shaping: Input is padded and split into Grid chunks.
  2. Key Handling: A symmetric key is either provided or securely generated.
  3. Nonce Generation: A random nonce is generated for CTR mode.
  4. CTR Mode Encryption: Each plaintext Grid is XORed with a keystream block derived from encrypting the nonce plus block counter.

Functions§

encrypt
Encrypts a vector of i64 values.
encrypt_string
Encrypts a string.