Module decrypter

Module decrypter 

Source
Expand description

REX Decrypter

This module defines the core decryption for WHY2, including round-key reversal, Grid unmixing and deterministic unshuffling. It reconstructs the original data from encrypted Grid chunks using a symmetric key.

§Overview

WHY2 encrypts data by transforming it into fixed-size grids (Grid) using CTR mode with a block cipher. Decryption reverses this process:

  1. Round Key Generation: Reconstructs round keys from the master key using chained SHA-256 seeds.
  2. CTR Mode Decryption: Each ciphertext Grid is XORed with the keystream block (the nonce plus block counter encrypted with WHY2).

Since CTR mode is symmetric, the same encryption function is used for both encryption and decryption.

Functions§

decrypt
Decrypts a WHY2-encrypted data into raw i64 values.
decrypt_string
Decrypts a WHY2-encrypted data and reconstructs the original string.