6 releases
| 0.2.0 | Jun 18, 2025 |
|---|---|
| 0.1.4 | Aug 21, 2024 |
| 0.1.3 | Mar 24, 2022 |
| 0.1.2 | Nov 19, 2020 |
#673 in Cryptography
171 downloads per month
8KB
79 lines
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));
}
simplestcrypt
Simplest way to perform a symmetric encryption, using a preshared key. Very small wrapper around aes-siv crate, with randomly generated nonces, for anything more advanced, use aes-siv instead
Example
use std::str;
fn main() {
let payload = "Hello world!".as_bytes();
let password = b"hello wooooooooo";
let encrypted = simplestcrypt::encrypt_and_serialize(&password[..], &payload).unwrap();
let plain = simplestcrypt::deserialize_and_decrypt(&password[..], &encrypted).unwrap();
println!("{:?}", str::from_utf8(&plain));
}
Dependencies
~2–2.9MB
~62K SLoC