Crates.io | plain-aes |
lib.rs | plain-aes |
version | 0.1.1 |
source | src |
created_at | 2024-09-28 21:59:17.435027 |
updated_at | 2024-09-28 22:10:09.051457 |
description | An implementation of Rijndael's cipher, commonly known as AES. |
homepage | |
repository | https://github.com/emdCatalyst/plain-aes |
max_upload_size | |
id | 1390397 |
size | 145,003 |
An implementation of Rijndael's cipher, commonly known as Advanced Encryption Standard.
&[str]
and &[u8]
encryption/decryption.To use the crate, either add plain-aes
to your Cargo.toml
's dependecies, or run cargo add plain-aes
.
Here's a quick example on how to encrypt a text message in AES128-ECB:
use plain_aes::{encrypt, ModeOfOperation, CipherVersion};
let message = "This is a super secret message";
let key = "This lib is cool"; // This lib is cool
let encrypted_message = encrypt(message, CipherVersion::Aes128(key.as_bytes(), ModeOfOperation::ECB)).unwrap();
let expected_enrypted: &[u8] = &[
0x11, 0x2B, 0xBD, 0x0D, 0x4C, 0x0C, 0xC5, 0x02, 0xB4, 0xC1, 0x38, 0xFD, 0x9A, 0x56,
0xC1, 0xA8, 0x78, 0x61, 0xD9, 0xF5, 0x6B, 0x48, 0xCC, 0xC5, 0x48, 0x14, 0xF2, 0x8C,
0x1A, 0x25, 0x11, 0xA3,
];
assert!(expected_enrypted.iter().eq(encrypted_message.iter()))
Refer to the docs, or the tests folder for in-depth examples and documentation.
This project is licensed under both the MIT and Apache 2.0 License. See LICENSE-APACHE and LICENSE-MIT for details.
This crate is intended for educational and experimental purposes only and should not be used in production environments. For security-critical applications, it is strongly recommended to use established and well-tested cryptographic libraries that have undergone rigorous security audits. The author shall not be liable for any damages, including but not limited to direct, indirect, incidental, special, exemplary, or consequential damages, arising out of or in connection with the use or inability to use this crate.