Skip to content

feat: remaster pub API#88

Merged
cyphersnake merged 26 commits intomainfrom
feat-remaster
Dec 9, 2025
Merged

feat: remaster pub API#88
cyphersnake merged 26 commits intomainfrom
feat-remaster

Conversation

@cyphersnake
Copy link
Collaborator

@cyphersnake cyphersnake commented Nov 28, 2025

  • migrate from unsafe gate-hasher single-aes to safe gate-hasher single-aes
  • migrate from unsafe ciphertext-hasher to blake3 ciphertext-hasher
  • remaster pub api
  • refactor cut_and_choose::vsss module structure

TODO

I plan to provide three modules:

  • gsv::cut_and_choose::vanilly
  • gsv::cut_and_choose::soldering (under the 'soldering' cargo-feature)
  • gsv::cut_and_choose::vsss (under the 'vsss' cargo-feature)

Each of which is completely independent of the others.

sander2 and others added 16 commits November 27, 2025 14:45
…hash

This PR migrates the ciphertext hashing mechanism from AES-based
accumulation to Blake3, improving performance and security for high-volume
ciphertext processing (designed for 2.7B+ ciphertexts).

- Replace `AESAccumulatingHash` with `Blake3AccumulatingHash`
- Replace `AESAccumulatingHashBatch<N>` with `Blake3AccumulatingHashBatch<N>`
- Implement batched hashing (64 ciphertexts per batch = 1KB, matching
  Blake3's optimal chunk size)
- Add domain separation via u64 batch index prefix for each batch
- Zero-allocation hot path design using fixed-size buffers:
  - `[S; 64]` ciphertext buffer
  - 1032-byte pre-allocated serialization buffer
- Change `HASH_OUTPUT_SIZE` from 16 to 32 bytes (full Blake3 output)

- Update `CiphertextSource::finalize()` signature from `&self` to `self`
  to allow flushing remaining buffered ciphertexts
- Update `CiphertextCommit` type alias to use 32-byte output
- Remove deprecated AES accumulator code entirely (no backward compatibility)

- `src/circuit/mod.rs` - MultiCiphertextHandler implementations
- `src/circuit/ciphertext_source.rs` - FileSource and trait definitions
- `src/cut_and_choose/` - garbler, evaluator, ciphertext_repository
- All examples and tests updated to use Blake3 types

Blake3 is designed for high-throughput hashing with:
- SIMD acceleration on modern CPUs
- Optimal performance with ~1KB input chunks
- Built-in parallelization support
- Stronger 256-bit security vs AES-MMO's 128-bit

The batched approach reduces per-ciphertext overhead while maintaining
order-dependent sequential accumulation for deterministic results.
Switch from custom AES-NI implementation to Swanky library's AES hasher
for gate hashing. This simplifies garble_gate_batch by using the generic
GateHasher trait instead of hardcoded AES-NI batch operations.
Signed-off-by: Your Name <you@example.com>
Signed-off-by: cyphersnake <cyphersnake@pm.me>
@cyphersnake cyphersnake self-assigned this Nov 28, 2025
@sander2
Copy link

sander2 commented Nov 28, 2025

LGTM so far

@cyphersnake
Copy link
Collaborator Author

  Overhead vs Vanilla Baseline

  | Version         | Total Time | Overhead     | Overhead % |
  |-----------------|------------|--------------|------------|
  | Vanilla         | 1h 19m 39s | 0 (baseline) | 0%         |
  | VSSS            | 1h 23m 26s | +3m 47s      | +4.7%      |
  | Soldering (SP1) | 1h 31m 49s | +12m 10s     | +15.3%     |

@cyphersnake cyphersnake marked this pull request as ready for review December 3, 2025 12:39
@cyphersnake cyphersnake merged commit 52b4912 into main Dec 9, 2025
8 of 9 checks passed
@cyphersnake cyphersnake deleted the feat-remaster branch December 9, 2025 15:31
@sander2 sander2 mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants