International Association for Cryptologic Research

International Association
for Cryptologic Research

Transactions on Cryptographic Hardware and Embedded Systems 2026

Memory Optimizations of Wagner’s Algorithm with Applications to Equihash


README

Wagner-Algorithms

Code accompanying the paper: "Memory Optimizations of Wagner’s Algorithm with Applications to Equihash". The paper is available at https://eprint.iacr.org/2025/2141. The artifact is organized as follows:

New Memory Optimizations of Wagner's Algorithms

We propose three new techniques to optimize Wagner's algorithms:

Theoretically, our techniques can reduce the peak memory usage of Wagner's algorithm by half (from $2nN$ to $nN$ bits) across most parameter settings, while incurring no more than a twofold time penalty. For example, the figure below shows that our new advanced post-retrieval technique achieves an almost linear time–memory trade-off curve, which is strictly better than the curve obtained by existing List Size Reduction (LSR) techniques.

trade-off

Under the hybrid framework, the memory footprint can be further reduced (below $nN$ bits, i.e., q > 2) at the cost of additional computational overhead. More estimators and theoretic resluts are available in python-poc.

Implementations of Post-Retrieval Technique

Our implementation serves solely as a proof of concept and does not incorporate aggressive low-level optimizations. We also note that these optimizations may significantly impact the ASIC-resistance of existing blockchains that rely on $\textsf{Equihash}$. We therefore recommend that such blockchains reassess the memory bottlenecks of ASIC implementations across all $\textsf{Equihash}$ parameter settings.

apr-time-mem

For the parameter setting $\textsf{Equihash}(144, 5)$, a subset of our optimization results is shown below (serving only as a proof of concept). Our implementations outperform Tromp's baseline implementation (CIP) in both time and memory usage.

Algorithm Sol/s Avg RunTime (s) Total solutions Peak USS (MB)
CIP 0.23 8.45 198 1453.12
CIP-PR 0.08 24.94 198 706.79
CIP-EM 0.22 9.05 198 707.54
CIP-APR 0.10 19.77 198 713.68
Tromp-Baseline 0.20 9.11 190 2569.69

Details are available in advanced-cip.

Quick Start

Clone the repository:

git clone --depth 1 https://github.com/tl2cents/Wagner-Algorithms.git
cd Wagner-Algorithms
  1. Explore Estimators (Python): Navigate to python-poc to run estimation scripts and proof-of-concept of our improved index-trimming technique.

  2. Run Benchmarks (C++): Navigate to advanced-cip to build and run the C++ benchmarks (advanced post-retrieval technique).