pub fn decrypt<const W: usize, const H: usize>(
input: EncryptedData<W, H>,
) -> Result<DecryptedData, GridError>Expand description
Decrypts a WHY2-encrypted data into raw i64 values.
This function reverses the full WHY2 encryption pipeline using CTR mode:
$$ P_i = C_i \oplus E_K(\text{Nonce} + i) $$
where $E_K$ is the WHY2 block cipher and $i$ is the block counter.
- Generates round keys from the master key
- Applies CTR mode decryption (XOR with keystream blocks)
§Parameters
-
input: AnEncryptedDatastruct containing the encrypted grids and key grid. -
Ok(
DecryptedData) struct containing:output: A vector of decryptedi64valueskey: The original keyGridflattened into a vector
-
Err(String) if
Gridarea is 1