An open API service indexing awesome lists of open source software.

https://github.com/manuelpuebla/hermite_iopp

High-performance Rust implementation of Interactive Oracle Proofs of Proximity (IOPP) for Hermitian curves over binary fields. Features bitsliced F₂⁴ arithmetic with 16× speedup.
https://github.com/manuelpuebla/hermite_iopp

algebraic-geometry bitslicing cryptography fri hermitian-curves iopp rust zero-knowledge-proofs

Last synced: 23 days ago
JSON representation

High-performance Rust implementation of Interactive Oracle Proofs of Proximity (IOPP) for Hermitian curves over binary fields. Features bitsliced F₂⁴ arithmetic with 16× speedup.

Awesome Lists containing this project

README

          

# HermiteIOPP

**Interactive Oracle Proofs of Proximity for Hermitian Curves over Binary Fields**

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

A high-performance Rust implementation of Interactive Oracle Proofs of Proximity (IOPP) for Algebraic Geometry codes, specifically targeting Hermitian curves over characteristic-2 fields.

## Overview

HermiteIOPP implements an optimized IOPP protocol for proving proximity to Hermitian AG codes. The implementation leverages domain-specific optimizations including:

- **Bitsliced arithmetic** for F₂⁴ operations (16× speedup on constant multiplication)
- **Barycentric interpolation** for small folding factors
- **Batch processing** with automatic amortization of transpose costs
- **Zero-copy operations** where possible through careful memory layout

**Target performance**: Within 1.2× of classical FRI for n = 2²⁰ evaluation points, while using a 256× smaller alphabet.

## Features

- ✅ Hermitian curve operations over F₂⁴
- ✅ Bitsliced field arithmetic (64-element batches)
- ✅ Barycentric Lagrange interpolation
- ✅ AG-IOPP commit and query phases
- ✅ Comprehensive test suite
- 🔄 AVX-512 backend (in progress)
- 📋 GPU acceleration (planned)

## Quick Start

### Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
hermite_iopp = "0.1"
```

### Basic Usage

```rust
use hermite_iopp::{HermitianCurve, IOPPProver, IOPPVerifier};
use hermite_iopp::field::F2_4;

// Setup: Hermitian curve y^17 + y = x^16 + x over F_{2^16}
let curve = HermitianCurve::new(4); // q = 2^4 = 16

// Prover: Generate proof for codeword proximity
let prover = IOPPProver::new(curve);
let codeword = vec![F2_4::random(); 1 << 20]; // n = 2^20 points
let proof = prover.prove(&codeword);

// Verifier: Check proximity
let verifier = IOPPVerifier::new(curve);
let is_valid = verifier.verify(&proof);
```

### Running Benchmarks

```bash
# Benchmark field operations
cargo bench --bench field_ops

# Benchmark FAFFT/interpolation
cargo bench --bench fafft

# Benchmark full IOPP commit phase
cargo bench --bench iopp_commit

# Compare with FRI baseline
cargo bench --bench comparison
```

## Architecture

```
hermite_iopp/
├── src/
│ ├── lib.rs # Public API
│ ├── field/
│ │ ├── mod.rs # Field traits
│ │ ├── f2_4.rs # F₂⁴ implementation
│ │ └── bitsliced.rs # Bitsliced F₂⁴ (64 elements)
│ ├── curve/
│ │ ├── mod.rs # Curve traits
│ │ ├── hermitian.rs # Hermitian curve y^(q+1)+y = x^q+x
│ │ └── projections.rs # Fiber computations
│ ├── interpolation/
│ │ ├── mod.rs # Interpolation traits
│ │ ├── barycentric.rs # Barycentric Lagrange
│ │ └── fafft.rs # Frobenius Additive FFT
│ ├── iopp/
│ │ ├── mod.rs # IOPP protocol
│ │ ├── prover.rs # Commit phase
│ │ ├── verifier.rs # Query phase
│ │ └── folding.rs # Folding operators
│ └── utils/
│ ├── mod.rs
│ └── batching.rs # Batch processing utilities
├── benches/ # Criterion benchmarks
├── tests/ # Integration tests
└── examples/ # Usage examples
```

## Performance

### Comparison with FRI (n = 2²⁰)

| Metric | FRI | HermiteIOPP | Ratio |
|--------|-----|-------------|-------|
| Rounds | 20 | 5 | 4× fewer |
| Alphabet size | 2⁶⁴ | 2¹⁶ | 256× smaller |
| Prover time (Rnd 0) | 1.0M cycles | 1.2M cycles | 1.2× slower |
| Queries per test | 2 | 16 | 8× more |
| Total queries (2⁻⁸⁰) | 160 | 640 | 4× more |

**Recommendation**: HermiteIOPP excels in bandwidth-constrained scenarios or hardware with native F₂ᵐ support.

### Micro-benchmarks

Cycle counts per operation (averaged over 10K iterations):

| Operation | Packed (v2.0) | Bitsliced (v3.0) | Speedup |
|-----------|---------------|------------------|---------|
| Add | 0.5 | 0.06 | 8× |
| Mul (const) | 1.0 | 0.06 | **16×** |
| Mul (general) | 1.0 | 0.2 | 5× |
| Interpolate (q=16) | 256 | 64 | 4× |

## Technical Details

### Field Choice: F₂⁴

We use the 4-bit binary extension field F₂⁴ = F₂[x]/(x⁴ + x + 1).

**Rationale**:
- Small enough for full lookup tables (256 bytes)
- Large enough to avoid excessive queries (16 elements per fiber)
- Perfect for bitslicing (4 bits → 4 registers for 64 elements)

### Curve Equation

**Hermitian curve in trace form**:
```
y^(q+1) + y = x^q + x over F_{2^{2m}}
```

For q = 16:
```
y^17 + y = x^16 + x over F_{2^8}
```

**Key property**: Fibers π⁻¹(P) are affine subspaces of dimension log₂(q) = 4.

**Why trace form?**
- Ensures fibers are *additive* subspaces (required for FAFFT)
- Compatible with Artin-Schreier tower structure
- Enables efficient computation via solving linear equations

### Bitslicing Explained

Traditional representation of 64 elements:
```
[elem0, elem1, ..., elem63] // 64 nibbles
```

Bitsliced representation:
```rust
struct BitslicedF2_4 {
bit0: u64, // bit 0 of all 64 elements
bit1: u64, // bit 1 of all 64 elements
bit2: u64, // bit 2 of all 64 elements
bit3: u64, // bit 3 of all 64 elements
}
```

**Advantage**: Operations become Boolean logic on u64 registers.

Example (multiply by x):
```rust
// Standard: 1 cycle per element (via LUT)
for i in 0..64 {
result[i] = MUL_X_TABLE[input[i]]; // 64 cycles total
}

// Bitsliced: 4 cycles for all 64 elements
result.bit0 = input.bit3;
result.bit1 = input.bit0 ^ input.bit3;
result.bit2 = input.bit1;
result.bit3 = input.bit2;
// 16× faster!
```

## Documentation

- [Optimization History](OPTIMIZATION_HISTORY.md) - Detailed evolution of the implementation
- [API Documentation](https://docs.rs/hermite_iopp) - Generated from rustdoc
- [Examples](examples/) - Usage examples and tutorials

### Key Algorithms

1. **Barycentric Interpolation** (`interpolation/barycentric.rs`)
- O(q) complexity for fixed point sets
- Precomputed Lagrange weights
- Ideal for small q (≤ 32)

2. **Bitsliced Multiplication** (`field/bitsliced.rs`)
- Precomputed Boolean circuits for each constant
- 16× speedup on constant multiplication
- Cache-friendly (all data in 4 registers)

3. **Folding Operator** (`iopp/folding.rs`)
- Combines interpolation + balancing functions
- Batch-optimized for 64 points at once
- Minimal allocations via arena allocator

## Testing

```bash
# Run all tests
cargo test

# Run with detailed output
cargo test -- --nocapture

# Test specific module
cargo test field::

# Property-based testing
cargo test --features proptest
```

## Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

Areas of interest:
- AVX-512 backend implementation
- GPU acceleration (CUDA/OpenCL)
- Alternative curve families (Hermitian tower, Suzuki curves)
- Formal verification of critical components

## License

Licensed under either of:

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
- MIT License ([LICENSE-MIT](LICENSE-MIT))

at your option.

## Citation

If you use this code in your research, please cite:

```bibtex
@software{hermite_iopp,
title = {HermiteIOPP: Interactive Oracle Proofs for Hermitian Curves},
author = {Your Name},
year = {2025},
url = {https://github.com/yourusername/hermite_iopp}
}
```

## References

1. Bordage et al. "Interactive Oracle Proofs of Proximity to Algebraic Geometry Codes" (CCC 2022)
2. van der Hoeven & Larrieu "The Frobenius FFT" (ISSAC 2017)
3. Li et al. "Frobenius Additive Fast Fourier Transform" (ISSAC 2018)
4. Gao & Mateer "Additive Fast Fourier Transforms" (IEEE Trans. IT 2010)

## Acknowledgments

This implementation benefited from detailed peer review and optimization insights. Special thanks to contributors who identified critical corrections in the initial design.

---

**Status**: Alpha (v0.1.0) - API may change
**Maintained by**: [Your Name]
**Contact**: your.email@example.com