diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2026-04-28 17:59:14 +0200 |
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2026-04-28 17:59:14 +0200 |
| commit | 8c54e253451cc4c6578f86db25a057fbf702fd4b (patch) | |
| tree | 77b16cb4423d816f0b2ee0e57cd9ded8f23d2c3a /README.md | |
| parent | 13fb026842345a5aad0cb7788bf327e03b521222 (diff) | |
| download | leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.tar.gz leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.tar.bz2 leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.zip | |
add metadata
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..f11059c --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# leona + +[](https://crates.io/crates/leona) +[](https://choosealicense.com/licenses/mit/) +[](https://docs.rs/leona) + +Implementation of +[LIONESS](https://link.springer.com/content/pdf/10.1007/3-540-60865-6_48.pdf) +in Rust. Works with `no_std` and generic over hashes/ciphers. + +## ☣️ Cryptographic hazmat ☣️ + +This crate is not battle tested and not audited. It exists as a learning +exercise. Use it at your own risk. + +## LIONESS + +LIONESS is a wide block cipher, constructed using a hash algorithm and a stream +cipher. From the paper: + +> Each ciphertext bit depends on all the plaintext bits in a very complex way, +> which contributes to the cryptographic strength. + +## Example use + +You need a hash algorithm and a compatible stream cipher (compatible means that +the hash output has the same size as the stream cipher key): + +```rust +use leona::{Lioness, ZeroIv}; +use blake2::Blake2sMac256; +use chacha20::ChaCha20; + +type Cipher = Lioness<ZeroIv<ChaCha20>, Blake2sMac256>; + +let mut data = [0u8; 64]; +data[..11].copy_from_slice(b"hello world"); + +let cipher = Cipher::new_dynamic(b"secret"); +cipher.encrypt(&mut data); +assert_ne!(&data[..11], b"hello world"); +cipher.decrypt(&mut data); +assert_eq!(&data[..11], b"hello world"); +``` + +## Alternatives + +There are two drawbacks to LIONESS: + +1. It is slow. +2. It cannot encrypt short messages (shorther than the hash output size). + +If you require a wide block cipher, consider using a different construction +(like aez via [aez](https://crates.io/crates/aez) or +[zears](https://crates.io/crates/zears)). + +## License + +This crate is licensed under the terms of the MIT license. You can find the full license text in LICENSE. + |
