Skip to main content

encrypt

Function encrypt 

Source
fn encrypt(data: &[u8], passphrase: &str) -> Result<Vec<u8>, String>
Expand description

Encrypts the given data using AES-256-GCM with a key derived from the provided passphrase.

§Arguments

  • data - The plaintext data to encrypt.
  • passphrase - The passphrase used to derive the encryption key.

§Returns

A Result containing the encrypted data as a Vec<u8> on success, or an error message as a String on failure.