LEX
Biryukov's leak-extraction stream cipher, which outputs bytes from inside AES rounds
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About LEX
LEX is a stream cipher. It uses a 16-byte (128-bit) key and a 16-byte nonce. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
LEX is a stream cipher designed by Alex Biryukov in 2005 and submitted to eSTREAM, where it reached the third phase. It runs AES in OFB-like fashion and outputs four bytes from the internal state after each round, rather than whole blocks.
LEX encrypts an IV under the key with AES, then repeatedly applies AES rounds to the result. After each round, four bytes at fixed positions of the 4x4 state are leaked as keystream. Because every round yields keystream, rather than every full ten-round encryption, the designer estimated it at about 2.5 times the speed of AES in OFB mode, while reusing existing AES implementations.
NextSSL includes LEX from source without verification. Reusing AES rounds means LEX benefits from AES hardware acceleration and from the extensive analysis of AES itself, but the leakage pattern created new attack surface that standard AES analysis did not cover. Its fate shows how carefully keystream extraction must be designed. Because the tier is unverified, outputs should be checked against independent reference values before they are relied on for anything beyond experimentation.
History
2004–2008ECRYPT launches eSTREAM to find new stream ciphers
eSTREAM projectLEX published by Alex Biryukov
34 designs submitted
eSTREAM projectFinal eSTREAM portfolio published
eSTREAM project
Security notes
Dunkelman and Keller published a key-recovery attack on LEX requiring about 2^36 bytes of keystream from many IVs, and LEX was not included in the eSTREAM portfolio. It should be treated as a research cipher.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 | Secret key |
| nonce | 16 | Nonce / IV |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
ct = root.call("stream_apply", "lex", None, key, nonce, b"secret")[0] # same call decrypts
nextssl_root_stream_apply("lex", NULL, key, nonce, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_streamcipher_in(reg::all(), Policy::Any, "lex", &Params::new())?;
let ct = alg.apply_keystream(&key, &nonce, b"secret")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More stream ciphers
All 37Frequently asked questions
What is LEX?
LEX is a stream cipher in the LEX family. LEX is a stream cipher designed by Alex Biryukov in 2005 and submitted to eSTREAM, where it reached the third phase.
What are the LEX sizes?
In NextSSL, LEX uses: key 16 bytes, nonce 16 bytes.
Who designed LEX and when?
LEX belongs to the LEX family, first published in 2005 by Alex Biryukov. Its origin: eSTREAM (phase 3).
Is LEX safe to use?
LEX is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).