Skip to main content

new_encryptor

Function new_encryptor 

Source
pub fn new_encryptor(key: &[u8], algorithm: Algorithm) -> Box<dyn Encryptor>
Expand description

Creates a new encryptor for the specified algorithm.

§Arguments

  • key - The encryption passphrase (used with PBKDF2-SHA256 to derive keys)
  • algorithm - The encryption algorithm to use

§Returns

A boxed trait object implementing Encryptor.

§Examples

use rskit_encryption::{new_encryptor, Algorithm};

let encryptor = new_encryptor(b"secret-key", Algorithm::ChaCha20Poly1305);