gen_nonce

Function gen_nonce 

Source
pub fn gen_nonce(algorithm: &Algorithm, mode: &Mode) -> Vec<u8> 
Expand description

This can be used to generate a nonce for encryption It requires both the algorithm and the mode, so it can correctly determine the nonce length This nonce can be passed directly to EncryptionStreams::initialize()

§Examples

let nonce = gen_nonce(&Algorithm::XChaCha20Poly1305, &Mode::StreamMode);