mirror of
https://github.com/logos-storage/lioness_blockcipher.git
synced 2026-05-18 18:49:28 +00:00
21 lines
479 B
Rust
21 lines
479 B
Rust
|
|
use lioness_blockcipher::{Lioness, MasterKey};
|
||
|
|
|
||
|
|
fn main() -> anyhow::Result<()> {
|
||
|
|
let key: MasterKey = [0x42; 32];
|
||
|
|
|
||
|
|
let cipher = Lioness::new(&key);
|
||
|
|
|
||
|
|
// Blocks must be at >32 bytes long
|
||
|
|
let mut block = b"this is a long plaintext block and must stay a secret".to_vec();
|
||
|
|
let original = block.clone();
|
||
|
|
|
||
|
|
cipher.encrypt_in_place(&mut block)?;
|
||
|
|
|
||
|
|
cipher.decrypt_in_place(&mut block)?;
|
||
|
|
|
||
|
|
assert_eq!(block, original);
|
||
|
|
println!("success!");
|
||
|
|
|
||
|
|
Ok(())
|
||
|
|
}
|