ncrypt_me - Secure Data Encryption
How the Data is Encrypted
Given some Credentials
(username and password):
-
Hashing: Both the password and username are hashed using Argon2.
- The resulting hash of the password is used as the key for the XChaCha20Poly1305 cipher.
- The resulting hash of the username is used as the Additional Authenticated Data (AAD) for the cipher.
-
Encryption: With the key and AAD set, the data is encrypted using the XChaCha20Poly1305 cipher.
-
Output: The encrypted data is then returned.
Example
use ;
let exposed_data: = vec!;
let credentials = new;
let argon_params = very_fast;
let secure_data = from_vec.unwrap;
let encrypted_data = encrypt_data.unwrap;
let decrypted_data = decrypt_data.unwrap;
decrypted_data.slice_scope;
Extracting the Encrypted Info (if needed)
The Encrypted Info contains the following information:
- Password Salt used for the password hashing
- Username Salt used for the username hashing
- Cipher Nonce used for the XChaCha20Poly1305 cipher
- Argon2 Parameters used for the username & password hashing
use EncryptedInfo;
let info = from_encrypted_data.unwrap;