mirror of
https://github.com/logos-storage/lioness_blockcipher.git
synced 2026-05-18 18:49:28 +00:00
28 lines
606 B
Rust
28 lines
606 B
Rust
use rand_core::{OsRng, RngCore};
|
|
use lioness_blockcipher::prelude::*;
|
|
type TestLioness = Lioness::<
|
|
ChaCha20StreamCipher,
|
|
KeyedBlake2b,
|
|
TurboShake128Kdf
|
|
>;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let mut key: Key256 = Default::default();
|
|
OsRng.fill_bytes(&mut key);
|
|
|
|
let cipher: TestLioness = Lioness::new(&key)?;
|
|
|
|
// Blocks must be at >64 bytes long
|
|
let mut block = vec![0x84u8; 65];
|
|
let original = block.clone();
|
|
|
|
cipher.encrypt_in_place(&mut block)?;
|
|
|
|
cipher.decrypt_in_place(&mut block)?;
|
|
|
|
assert_eq!(block, original);
|
|
println!("success!");
|
|
|
|
Ok(())
|
|
}
|