pub fn encrypt_with_context(
plaintext: impl AsRef<[u8]>,
passphrase: impl AsRef<[u8]>,
argon2_type: Algorithm,
argon2_version: Version,
params: Params,
) -> Result<Vec<u8>>Available on crate feature
alloc only.Expand description
Encrypts plaintext with the specified Algorithm, Version and
Params and into a newly allocated Vec.
This is a convenience function for using Encryptor::with_context and
Encryptor::encrypt_to_vec.
§Errors
Returns Err if the Argon2 context is invalid.
§Examples
let data = b"Hello, world!\n";
let passphrase = "passphrase";
let params = Params::new(32, 3, 4, None).unwrap();
let ciphertext =
abcrypt::encrypt_with_context(data, passphrase, Algorithm::Argon2i, Version::V0x10, params)
.unwrap();