Expand description
Shamelessly copied (and slightly updated) from https://blog.azerpas.com/posts/rust-encryption-1
See https://gist.github.com/azerpas/b0820999293ec4c1b5e0dc6f66f1f545
Functions§
- decrypt
- Decrypts the ciphertext with the given password and returns the plaintext.
- encrypt
- 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.