jedisct1/areion
The AREION public crypto permutation, implemented in Zig.
Fast Zig implementation of the Areion permutation family presented at CHES 2023. This library provides both Areion512 and Areion256 variants, optimized for speed particularly on small inputs.
# Build the library (creates zig-out/lib/libareion.a)
zig build
# Build with optimizations
zig build --release=fast # Optimized for performance
zig build --release=safe # Optimized with safety checks
zig build --release=small # Optimized for size
# Run tests
zig build test
This library provides a standard hash function interface compatible with other Zig crypto libraries:
const std = @import("std");
const areion = @import("areion");
// Areion512 hash function
var output512: [32]u8 = undefined;
areion.Areion512.hash("your message here", &output512, .{});
// Areion256 hash function
var output256: [16]u8 = undefined;
areion.Areion256.hash("your message here", &output256, .{});
// Direct permutation usage (advanced)
var state512 = areion.Areion512{};
state512.absorb([_]u8{0x01} ** 32); // Absorb 32-byte input
state512.permute(); // Apply permutation
const squeezed = state512.squeeze(); // Extract 32-byte output
// Authenticated encryption with AreionOCH
const key: [32]u8 = ...; // 256-bit key
const npub: [24]u8 = ...; // 192-bit public nonce
const nsec: [8]u8 = ...; // 64-bit secret nonce
const plaintext = "secret message";
const associated_data = "metadata";
var ciphertext: [plaintext.len + 8]u8 = undefined;
var tag: [32]u8 = undefined;
areion.AreionOCH.encrypt(&ciphertext, &tag, plaintext, associated_data, npub, nsec, key);
// Decryption
var decrypted: [plaintext.len]u8 = undefined;
var recovered_nsec: [8]u8 = undefined;
try areion.AreionOCH.decrypt(&decrypted, &recovered_nsec, &ciphertext, tag, associated_data, npub, key);
block_length: 32 bytes (input block size)digest_length: 32 bytes (output hash size)hash(input, output, options): Main hash functionfromBytes(bytes): Create instance from 64-byte stateabsorb(bytes): Absorb 32-byte input blocksqueeze(): Extract 32-byte outputpermute(): Apply 15-round permutationblock_length: 16 bytes (input block size)digest_length: 16 bytes (output hash size)hash(input, output, options): Main hash functionfromBytes(bytes): Create instance from 32-byte stateabsorb(bytes): Absorb 16-byte input blocksqueeze(): Extract 16-byte outputpermute(): Apply 10-round permutationAuthenticated encryption with associated data (AEAD) based on the OCH construction (CCS 2025).
key_length: 32 bytesnpub_length: 24 bytes (public nonce)nsec_length: 8 bytes (secret nonce, embedded in ciphertext)tag_length: 32 bytes (authentication tag)encrypt(c, tag, m, ad, npub, nsec, key): Encrypt and authenticatedecrypt(m, nsec, c, tag, ad, npub, key): Decrypt and verify (returns AuthenticationError on failure)Security properties:
Standard Merkle-Damgård padding:
This implementation is optimized for:
This implementation is based on:
Implementation uses corrected test vectors from the updated Areion paper.