Function generate_key

Source
pub fn generate_key(length: usize) -> Vec<u8> 
Expand description

Returns a random key of the specified length. Can also be used whenever you need a random byte array, like for a salt.

§Arguments

  • length - Length of the desired key.

§Example

use devolutions_crypto::utils::generate_key;

let key = generate_key(32);
assert_eq!(32, key.len());