Function encrypt_with_params

Source
pub fn encrypt_with_params(
    plaintext: impl AsRef<[u8]>,
    passphrase: impl AsRef<[u8]>,
    params: Params,
) -> Vec<u8> 
Available on crate feature alloc only.
Expand description

Encrypts plaintext with the specified Params and into a newly allocated Vec.

This is a convenience function for using Encryptor::with_params and Encryptor::encrypt_to_vec.

§Examples

let data = b"Hello, world!\n";
let passphrase = "passphrase";

let params = Params::new(10, 8, 1, Params::RECOMMENDED_LEN).unwrap();
let ciphertext = scryptenc::encrypt_with_params(data, passphrase, params);