Grain128aeadv2
A stream-cipher-based AEAD from the Grain family, with a 96-bit IV and 64-bit tag
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 Grain128aeadv2
Grain128aeadv2 is an authenticated encryption (AEAD) scheme from the Grain-128AEAD family. It uses a 16-byte (128-bit) key, a 12-byte nonce and an 8-byte (64-bit) authentication tag. 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
Grain-128AEAD is an authenticated encryption design from the Grain stream cipher family, using a 16-byte key, a 12-byte nonce and an 8-byte tag. It was submitted to the NIST Lightweight Cryptography process. NextSSL carries the second version as an unverified variant.
Grain-128AEAD extends the Grain stream cipher family with message authentication. Its state combines a linear and a nonlinear feedback shift register with an accumulator that produces the tag, so the same compact hardware structure that makes Grain attractive also generates authentication.
NextSSL carries the variant grain128aeadv2 with a 16-byte key, a 12-byte nonce and an 8-byte tag. The 8-byte tag gives roughly 64-bit forgery resistance, which is short for general use. The design was aimed at very constrained hardware, and the archive records it as unverified.
Its design is closely related to the Grain-128 stream cipher, which is also in the archive under the grain entry, so cryptanalysis of the base cipher is relevant background for this variant.
History
2018–2025NIST calls for lightweight AEAD and hashing designs
NIST Lightweight Cryptography projectGrain-128AEAD published by Martin Hell, Thomas Johansson, Alexander Maximov, Willi Meier
56 round-1 candidates accepted; 32 advance to round 2 in August
NIST Lightweight Cryptography projectTen finalists announced
NIST Lightweight Cryptography projectAscon selected as the lightweight standard
NIST Lightweight Cryptography projectAscon published in NIST SP 800-232
NIST Lightweight Cryptography project
How it works
- The 16-byte key and 12-byte nonce load the two shift registers.
- A warm-up phase mixes the state before any output is used.
- Plaintext is encrypted by XOR with keystream while the authentication part updates an accumulator, producing the 8-byte tag.
Security notes
Unverified in NextSSL. Designs in the Grain family have a published cryptanalysis history, so the unverified tier is a reason for caution. The 8-byte tag limits forgery resistance.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 | Secret key |
| nonce | 12 | Nonce / IV |
| tag | 8 | Authentication tag |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
key, nonce = root.random(16), root.random(12)
ct = root.call("aead_seal", "grain128aeadv2", None, key, nonce, b"header", b"secret")[0] # ct || tag
pt = root.call("aead_open", "grain128aeadv2", None, key, nonce, b"header", ct)[0]
nextssl_root_aead_seal("grain128aeadv2", NULL, key, nonce, aad, pt, out); /* writes ct || tag */
nextssl_root_aead_open("grain128aeadv2", NULL, key, nonce, aad, ct, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_aead_in(reg::all(), Policy::Any, "grain128aeadv2", &Params::new())?;
let ct = alg.seal(&key, &nonce, b"header", b"secret")?;
let pt = alg.open(&key, &nonce, b"header", &ct)?;
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 authenticated encryption
All 392Frequently asked questions
What is Grain128aeadv2?
Grain128aeadv2 is an AEAD in the Grain-128AEAD family. Grain-128AEAD is an authenticated encryption design from the Grain stream cipher family, using a 16-byte key, a 12-byte nonce and an 8-byte tag.
What are the Grain128aeadv2 sizes?
In NextSSL, Grain128aeadv2 uses: key 16 bytes, nonce 12 bytes, tag 8 bytes.
Who designed Grain128aeadv2 and when?
Grain128aeadv2 belongs to the Grain-128AEAD family, first published in 2019 by Martin Hell, Thomas Johansson, Alexander Maximov, Willi Meier. Its origin: NIST Lightweight Cryptography submission.
Is Grain128aeadv2 safe to use?
Grain128aeadv2 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).
Related families
Lightweight permutation-based AEAD; NIST lightweight standard (SP 800-232)
ChaCha20-Poly1305ARX stream cipher with a one-time Poly1305 MAC; fast and constant-time in software
Grain-128AEADLFSR/NLFSR stream cipher with an integrated MAC; NIST LWC finalist
KNOT-128A 128-bit permutation-based AEAD from the KNOT family, submitted to NIST lightweight cryptography
AsconNIST's lightweight standard: one 320-bit permutation for hashing, XOFs, MACs and AEAD
AsconNIST's lightweight standard: one 320-bit permutation for hashing, XOFs, MACs and AEAD