Expand description
The only goal of this library is to provide the easiest way to encrypt and decrypt a message to a computer, its a very very minimal and provides no choices for the user to increase performance or security.
It is a minimal wrapper for the crate aes_siv and anyone wanting anything more advanced than what this library provides should look in that crate where ALL the heavy lifting is performed.
Encryption and decryption example:
use std::str;
fn main() {
let payload = "Hello world!".as_bytes();
let password = b"secretpassword";
let encrypted = simplestcrypt::encrypt_and_serialize(&password[..], &payload).unwrap();
let plain = simplestcrypt::deserialize_and_decrypt(&password[..], &encrypted).unwrap();
println!("{:?}", str::from_utf8(&plain));
}
Structs§
- Encrypted
- Contains the Nonce used in the encryption process. This type is inflated when serialized using bincode (16 bytes for the nonce + 8 bytes with size of the Vec + (rest of bytes for Vec ciphertext).
Enums§
Functions§
- decrypt
- Decrypts an Encrypted structure using Aes128SivAead and returns a decrypted vector using the given password
- deserialize_
and_ decrypt - Assumes that the given bytes is a Bincode serialized Encrypted structure, and first deserializes it and then tries to decrypt it using the given password bytes
- encrypt
- Encrypts the given bytes using a random nonce using Aes128SivAed Password cannot be longer than 32 bytes
- encrypt_
and_ serialize - Encrypts the given bytes using a random nonce using Aes128SivAed, and then serializes the encryption along with the nonce using bincode. The resulting vector is then bincode serialized Encrypted structure