Function generate_aes_pair

Source
pub fn generate_aes_pair(str: &str) -> ([u8; 16], [u8; 16])
Expand description

Generate AES key and IV from a string

The function calculates the SHA-256 hash of the input string, and extracts two 16-bytes long data from the hash, treated as the AES key and IV.

§Arguments

  • str - The string to generate

§Example

let (key, iv) = generate_aes_pair("some data");
println!("Key: {:?}, IV: {:?}", key, iv);