Skip to content

std.crypto: add Ascon-AEAD, Ascon-Hash, Ascon-CHash - #25239

Merged
andrewrk merged 2 commits into
ziglang:masterfrom
jedisct1:ascon2
Sep 18, 2025
Merged

andrewrk merged 2 commits into
ziglang:masterfrom
jedisct1:ascon2

Conversation

@jedisct1

Copy link
Copy Markdown
Contributor

Ascon is the family of cryptographic constructions standardized by NIST for lightweight cryptography.

The Zig standard library already included the Ascon permutation itself, but higher-level constructions built on top of it were intentionally postponed until NIST released the final specification.

That specification has now been published as NIST SP 800-232: https://csrc.nist.gov/pubs/sp/800/232/final

With this publication, we can now confidently include these constructions in the standard library.

Also unbreak the benchmarks after the deprecatedWriter() removal.

Ascon is the family of cryptographic constructions standardized by NIST
for lightweight cryptography.

The Zig standard library already included the Ascon permutation itself,
but higher-level constructions built on top of it were intentionally
postponed until NIST released the final specification.

That specification has now been published as NIST SP 800-232:
https://csrc.nist.gov/pubs/sp/800/232/final

With this publication, we can now confidently include these constructions
in the standard library.
Comment thread lib/std/crypto/ascon.zig Outdated

@andrewrk andrewrk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


pub fn main() !void {
const stdout = std.fs.File.stdout().deprecatedWriter();
var stdout_buffer: [4096]u8 = undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you flush after every write, there's no need for a buffer. Recommend to either pass an empty buffer, and remove all the flush() calls, or flush only once at the end.

@andrewrk
andrewrk merged commit 4406127 into ziglang:master Sep 18, 2025
14 checks passed
@andrewrk andrewrk added the release notes This PR should be mentioned in the release notes. label Sep 18, 2025
@alexrp

alexrp commented Sep 19, 2025

Copy link
Copy Markdown
Member

This broke RISC-V CI: https://github.com/ziglang/zig/actions/runs/17816622839/job/50650980744

#25292

For future reference, you can add the https://github.com/ziglang/zig/labels/ci-riscv64-linux label to a PR to get RISC-V CI running on it. This can be a good idea to do whenever new algorithms/tests are added to std.crypto as LLVM still has a tendency to miscompile things there.

@jedisct1

Copy link
Copy Markdown
Contributor Author

Noted. Thanks @alexrp !

@alexrp alexrp removed the release notes This PR should be mentioned in the release notes. label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants