ascon-rs
Allocation-free Rust implementation of Ascon-AEAD128, Ascon-Hash256,
Ascon-XOF128, and Ascon-CXOF128 from
NIST SP 800-232.
Supports no_std, in-place authenticated encryption, streaming hashes/XOFs,
and a separate C ABI. Requires Rust 1.85+; the Rust core forbids unsafe code.
API docs · Repository · Examples
Add the dependency:
[]
= { = "ascon-rs", = "0.1" }
# For no_std, add: default-features = false
use ;
| Algorithm | Rust API |
|---|---|
| AEAD128 | Aead128 |
| Hash256 | hash256, Hash256 |
| XOF128 | xof128, Xof128 |
| CXOF128 | cxof128, Cxof128 |
Inputs and outputs are byte-oriented, with full 16-byte AEAD tags and at most 256 customization bytes. Empty XOF output is a no-op extension. The standardized little-endian algorithms are incompatible with pre-standard Ascon v1.2.
Never reuse a nonce with the same key. Applications manage key generation and per-key usage limits. Decryption authenticates before modifying output; stored keys and states are zeroized. See the AEAD usage requirements. This implementation has not undergone an independent security audit or NIST validation.
For C/C++, clone the repository and run cargo build -p ascon-ffi --release.
The repository-only FFI crate produces static and shared libraries; see the
C header and
C example.
Verification covers 4,228 reference vectors, 16 NIST examples, and 512 differential
cases. CI builds and tests on Linux, macOS, and Windows, including Rust 1.85 and
embedded no_std checks. Run cargo test --workspace --locked from a checkout.
The release workflow
publishes matching version tags to crates.io after CI passes.
License: GPL-3.0-only.