[−][src]Function simplecrypt::encrypt
pub fn encrypt(data: &[u8], passphrase: &[u8]) -> Vec<u8>
Encrypt data with an argon2id13 derived key of the given passphrase and a random nonce.
Recturns a Vec
Anatomy of the returned byte vector:
index | usage |
---|---|
0 - 15 | salt |
16 - 39 | nonce |
40 - 55 | mac |
56 - | data |
Examples
let plaintext = "lord ferris says: you shall not use Go"; let key = "lul no generics"; let encrypted_data_with_nonce = encrypt(plaintext.as_bytes(), key.as_bytes());