fn encrypt(&self, bytes: &[u8]) -> Vec<u8> {
        let nonce_string = Salt::generate(NONCE_SIZE as usize);
        let nonce = GenericArray::from_slice(nonce_string.as_bytes());
        let cipher_text = self.cipher.encrypt(nonce, bytes).unwrap();
        [nonce_string.as_bytes().to_vec(), cipher_text].concat()
    }
/// The lowest level method for encrypting data.
/// Encrypts `bytes` and prepends a 12 byte nonce
/// to the encrypted data.
///
/// # Arguments
///
/// `bytes` - Aata to encrypt
///
/// # Example
/// ```rust
/// use data_vault::encryption::traits::Encryption;
/// use data_vault::encryption::AesGcmSivEncryption;
///
/// let enc = AesGcmSivEncryption::new();
/// let test_data = String::from("Hello world!");
/// let encrypted_data = enc.encrypt(test_data.as_bytes());
/// ```
The lowest level method for encrypting data.
Encrypts `bytes` and prepends a 12 byte nonce
to the encrypted data.
The lowest level method for encrypting data . Encrypts ` bytes ` and prepends a 12 byte nonce to the encrypted data .
fn encrypt(&self, bytes: &[u8]) -> Vec<u8> {
        let nonce_string = Salt::generate(NONCE_SIZE as usize);
        let nonce = GenericArray::from_slice(nonce_string.as_bytes());
        let cipher_text = self.cipher.encrypt(nonce, bytes).unwrap();
        [nonce_string.as_bytes().to_vec(), cipher_text].concat()
    }
fn encrypt ( & self , bytes : & [ u8 ] ) -> Vec < u8 > { let nonce_string = Salt :: generate ( NONCE_SIZE as usize ) ; let nonce = GenericArray :: from_slice ( nonce_string . as_bytes ( ) ) ; let cipher_text = self . cipher . encrypt ( nonce , bytes ) . unwrap ( ) ; [ nonce_string . as_bytes ( ) . to_vec ( ) , cipher_text ] . concat ( ) }
The lowest level method for encrypting data.
The lowest level method for encrypting data .
&self
bytes
&[u8]
&self
bytes
&[u8]
example
```rust
use data_vault::encryption::traits::Encryption;
use data_vault::encryption::AesGcmSivEncryption.

let enc = AesGcmSivEncryption::new();
let test_data = String::from("Hello world!");
let encrypted_data = enc.encrypt(test_data.as_bytes());
```
` ` ` rust use data_vault :: encryption :: traits :: Encryption ; use data_vault :: encryption :: AesGcmSivEncryption . let enc = AesGcmSivEncryption :: new () ; let test_data = String :: from ( " Hello world! " ) ; let encrypted_data = enc . encrypt ( test_data . as_bytes () ) ; ` ` `