You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A pure Zig implementation of hash-based signatures using **Poseidon2** and **SHA3** with incomparable encodings. This library implements XMSS-like signatures based on the framework from [this paper](https://eprint.iacr.org/2025/055.pdf), with parameters inspired by the [hypercube-hashsig-parameters](https://github.com/b-wagn/hypercube-hashsig-parameters) project. Poseidon2 here targets the KoalaBear 31‑bit field with Montgomery arithmetic (compatible with plonky3 constants), optimized for throughput.
7
+
A pure Zig implementation of hash-based signatures using **Poseidon2** and **SHA3** with incomparable encodings. This library implements XMSS-like signatures based on the framework from [this paper](https://eprint.iacr.org/2025/055.pdf), with parameters matching the [hash-sig](https://github.com/b-wagn/hash-sig) Rust implementation. Poseidon2 here targets the KoalaBear 31‑bit field with Montgomery arithmetic (compatible with plonky3 constants), optimized for throughput.
8
8
9
9
## 🌟 Features
10
10
@@ -13,7 +13,7 @@ A pure Zig implementation of hash-based signatures using **Poseidon2** and **SHA
The hash-zig library includes several built-in programs for demonstration, testing, and performance analysis:
115
+
116
+
### Basic Example (`hash-zig-example`)
117
+
**Purpose**: Demonstrates basic usage of the hash-zig library
118
+
**Command**: `zig build example` or `zig build run`
119
+
**Description**: Shows how to generate keypairs, sign messages, and verify signatures. Includes timing measurements and displays key information. Perfect for understanding the library's core functionality.
120
+
121
+
### Performance Profiler (`hash-zig-profile`)
122
+
**Purpose**: Detailed performance analysis and profiling
123
+
**Command**: `zig build profile`
124
+
**Description**: Provides in-depth timing analysis of individual operations including WOTS (Winternitz One-Time Signature) operations, hash functions, and full key generation. Useful for understanding performance bottlenecks and optimization opportunities.
**Description**: Runs standardized performance tests across different key lifetimes (2^10 and 2^16). Measures key generation, signing, and verification times with detailed metrics. Outputs results in CI-friendly format for automated testing.
130
+
131
+
### SIMD Benchmark (`hash-zig-simd-benchmark`)
132
+
**Purpose**: Tests SIMD-optimized implementations
133
+
**Command**: `zig build simd-benchmark`
134
+
**Description**: Benchmarks SIMD-optimized versions of the hash-based signature scheme. Tests both 2^10 and 2^16 lifetimes with SIMD acceleration. Useful for comparing performance improvements from vectorization.
135
+
136
+
### Building All Programs
137
+
```bash
138
+
# Build all executables
139
+
zig build
140
+
141
+
# Run specific programs
142
+
zig build example # Basic usage demo
143
+
zig build profile # Performance profiling
144
+
zig build benchmark # Standard benchmark
145
+
zig build simd-benchmark # SIMD benchmark
146
+
```
147
+
148
+
### Program Outputs
149
+
All programs provide detailed timing information and can be used for:
150
+
-**Development**: Understanding library behavior and performance characteristics
151
+
-**Testing**: Verifying correct implementation and performance expectations
152
+
-**Benchmarking**: Comparing different implementations and optimizations
| Number of Chains | 22 | Matching Rust implementation |
263
+
| Chain Length | 256 | Winternitz parameter w=8 |
219
264
220
-
**Note**: The [hypercube-hashsig-parameters](https://github.com/b-wagn/hypercube-hashsig-parameters) repository recommends "**48 chains of length 10**" or "**64 chains of length 8**". We use **64 chains of length 8**.
265
+
**Note**: These parameters match the `SIGWinternitzLifetime18W8` instantiation from the [hash-sig](https://github.com/b-wagn/hash-sig) repository, ensuring compatibility between Rust and Zig implementations.
0 commit comments