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
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 permutationStandard Merkle-Damgård padding:
This implementation is optimized for:
This implementation is based on the corrected version of the Areion paper: