$ show ascon/ascon-c
The repository implements the Ascon family of lightweight cryptographic algorithms, including authenticated encryption (Ascon-AEAD128), hashing (Ascon-Hash256), extendable output functions (Ascon-XOF128), message authentication codes (Ascon-Mac), and pseudorandom functions (Ascon-Prf). It provides both reference and highly optimized implementations for diverse architectures (ARM, AVR, RISC-V, x86 with AVX512/NEON) and optimization levels (speed, size, side-channel resistance). The library follows the CAESAR API style with functions like crypto_aead_encrypt, crypto_aead_decrypt, and crypto_hash. Core operations use a 5-word state structure and apply permutation rounds (6, 8, or 12) based on the mode. The architecture is modular, separating algorithms into directories with subdirectories for implementation variants (reference, architecture-specific, low-size). While the code demonstrates strong cryptographic engineering and portability, it exhibits significant duplication across variants, increasing maintenance burden. However, reusable components exist, such as endianness handling, word abstraction, and bit-interleaving algorithms from 'Hacker's Delight'. The repository is actively maintained with recent commits and shows low technical drift.
The LLM identified 3 files worth highlighting for reuse:
Provides endianness conversion macros for 16, 32, and 64-bit values. Self-contained and dependency-free, making it reusable in any low-level or network programming context.
Defines a union type for word-sized access to byte arrays, supporting both little-endian and big-endian through explicit byte access. Includes macros for loading and storing bytes. No dependencies, suitable for cryptographic or low-level data processing.
Header file for bit-interleaving utility, accompanied by interleave.c containing function definitions. Implements efficient bit interleaving and deinterleaving algorithms (from Henry S. Warren's 'Hacker's Delight') for 32-bit words. Used in the BI32 variant of Ascon for bit-sliced implementation. Depends only on lendian.h (also highlighted).