libaes
This is a re-implementation of AES in safe Rust, with zero dependencies. The core algorithm is ported from AES core in OpenSSL 1.1.1 stable. This library strives to be:
- Correct (as the original OpenSSL implementation)
- Fast (as OpenSSL 1.1.1)
- Safe Rust code only.
- Minimal: no dependencies.
Currently, this library supports 128-bit, 192-bit and 256-bit keys with CBC mode only. Automatic padding is included.
Examples
use Cipher;
let my_key = b"This is the key!"; // key is 16 bytes
let plaintext = b"A plaintext";
let iv = b"This is 16 bytes";
// Create a new cipher
let cipher = new_128;
// Encryption
let encrypted = cipher.cbc_encrypt;
// Decryption
let decrypted = cipher.cbc_decrypt;
Correctness
We use a NIST test data to verify the cipher, see the test code.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Contributions are welcome! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the above license(s), shall be dual licensed as above, without any additional terms or conditions.