| Crates.io | libcipher |
| lib.rs | libcipher |
| version | 0.1.4 |
| created_at | 2025-06-12 06:40:58.696817+00 |
| updated_at | 2025-06-12 11:04:54.411602+00 |
| description | A Rust implementation of the Advanced Encryption Standard (AES) for secure data encryption and decryption. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1709407 |
| size | 13,901 |
A Rust implementation of the Advanced Encryption Standard (AES) for secure data encryption and decryption.
libcipher provides a simple and efficient way to encrypt and decrypt data using the AES algorithm. Support for different modes of operation, such as ECB and CBC, allows you to choose the best approach for your needs.
Add this to your Cargo.toml:
[dependencies]
libcipher = "0.1.3" # Replace with the latest version
use libcipher::{Cipher, Algorithm, Mode};
fn main() {
let key = b"your_secret_key".to_vec();
let iv = None; // Use None for ECB mode
let cipher = Cipher::new(Algorithm::AES, Mode::ECB, key, iv).unwrap();
let data = b"Hello, world!";
let encrypted_data = cipher.encrypt(data);
println!("Encrypted: {:?}", encrypted_data);
let decrypted_data = cipher.decrypt(&encrypted_data);
println!("Decrypted: {:?}", String::from_utf8(decrypted_data).unwrap());
}