#encryption-decryption #aes #package #cbc

very-simple-aes

simple AES cbc encryption and decryption package

2 stable releases

new 1.0.1 Dec 28, 2024

#1748 in Cryptography

Download history 189/week @ 2024-12-25

189 downloads per month

MIT license

7KB
102 lines

very simple AES

aes is complicated, and I realized I still have some old cbc functions for encrypting and decrypting. So I thought I would turn it into a package so you can also use it!

usage

every single encryption and decryption requires a name, password, and the data you want to encrypt. the output is the encrypted bytes of the data.

Example:

fn main(){
    let name = "joe";
    let password = "1234";
    let data = b"my very important secret";

    let encrypted = aes_encrypt(name, password, data);
    println!("Encrypted: {:?}", encrypted.to_vec()); // [229, 138, 19 ... 113, 59]
    let decrypted = aes_decrypt(name, password, &encrypted);
    println!("Decrypted: {}", String::from_utf8_lossy(decrypted.as_slice())); // my very important secret
}

credits

original code was made by aviv segal for a shared project

Dependencies

~4MB
~52K SLoC