generate_key

Function generate_key 

Source
pub fn generate_key<const W: usize, const H: usize>() -> Vec<i64>
Expand description

Generates a symmetric WHY2 key using secure system entropy.

This function creates a 32-byte seed using OsRng, then initializes a ChaCha20Rng with that seed to produce a deterministic stream of pseudorandom values. The output is a flat Vec<i64> of length 2 × W × H, suitable for use with Grid::from_key.

§Returns

A vector of signed 64-bit integers representing raw symmetric key material.

§Notes

  • The key is generated using system entropy and is cryptographically secure.
  • The output is deterministic for the derived seed, but the seed itself is random.
  • This method is suitable for one-time key generation in encryption workflows.