pub fn encrypt(
plaintext: impl AsRef<[u8]>,
password: impl AsRef<str>,
) -> Result<Vec<u8>>Expand description
Encrypts the plaintext with the given password and returns the ciphertext. The nonce is generated at each call to strengthen the encryption. Otherwise there’s a chance the key is weakened if the same nonce is used. The nonce is 24 byte (following the XCHACHA_NONCESIZE property). The ciphertext will be 40 bytes longer than the plaintext because of the XCHACHA_NONCESIZE + POLY1305_OUTSIZE size.
§Format
{0,24: nonce} {24,: ciphertext} …
§Arguments
plaintext: The plaintext to encryptpassword: The password to use for the encryption
§Returns
The ciphertext