Ternary-native cryptographic primitives for the post-quantum era.
Troika hashing | Lattice-based signatures & key exchange | Dual-mode backend (portable + SIMD)
Built in Rust. Designed for balanced ternary ({-1, 0, +1}) computation on both binary and future ternary hardware.
Balanced ternary is 1.58x more information-dense per digit than binary. Cryptographic operations that exploit this density can achieve:
- Faster hashing — Troika's 27-entry S-boxes vs AES's 256-entry tables
- Cheaper signatures — Lattice polynomial multiplication vs elliptic curve point multiplication (~10x faster verification)
- Post-quantum security — Lattice problems (NTRU, Dilithium) are believed resistant to quantum computers
- Compact encoding — Same security level, fewer digits, less bandwidth
These properties make ternary crypto ideal for low-fee blockchain transactions, post-quantum secure communication, and integrity verification of AI agent systems.
parakeet-crypto/
├── crates/
│ ├── ternary-backend/ # TernaryBackend trait + portable + SIMD implementations
│ ├── troika/ # Troika sponge hash function (243/384-trit output)
│ ├── lattice/ # NTRU KEM + ternary Dilithium signatures
│ └── parakeet-crypto/ # Facade crate — re-exports everything
├── benches/ # Criterion benchmarks with gas cost modeling
└── docs/
├── SPEC.md # Full technical specification
└── ARCHITECTURE.md # Design decisions and crate dependency graph
parakeet-crypto (facade)
├── troika ──────────┐
├── lattice ─────────┤
└────────────────────┴── ternary-backend
Consumers can depend on individual crates or pull in everything via parakeet-crypto.
use parakeet_crypto::prelude::*;
// Hash some data with Troika-243
let data = b"hello ternary world";
let hash = troika_243(data);
println!("Troika-243: {}", hash);
// Generate a lattice keypair and sign
let (sk, pk) = ternary_keygen();
let signature = ternary_sign(&sk, data);
assert!(ternary_verify(&pk, data, &signature));The TernaryBackend trait abstracts how trit operations execute:
| Backend | How it works | When to use |
|---|---|---|
| Portable | Pure Rust, Vec<Trit> loops |
Always works, reference implementation |
| SIMD | 2 bits/trit packed into AVX2/NEON vectors | Production on x86_64/aarch64, ~4-8x faster |
| Future | Trait-compatible slot for ternary hardware | FPGA, ternary CPU (BREEZE ecosystem) |
Backend is selected at runtime via CPU feature detection, or at compile time with cargo features:
cargo build # Portable backend (default)
cargo build --features simd # SIMD backend (AVX2 on x86_64, NEON on aarch64)cargo bench # Run all benchmarks
cargo bench --bench troika # Troika hash benchmarks only
cargo bench --bench lattice # Lattice crypto benchmarks onlyEvery operation reports:
- Throughput (trits/second, bytes/second)
- Latency (ns per operation)
- Gas cost (abstract cost unit for blockchain fee modeling)
Each cryptographic operation has an associated gas cost derived from benchmarked cycle counts:
| Operation | Estimated Gas | Comparison (Ethereum) |
|---|---|---|
| Troika-243 hash | TBD | Keccak-256: 30 gas |
| Troika-384 hash | TBD | — |
| Signature verify | TBD | ecrecover: 3000 gas |
| KEM decapsulate | TBD | — |
Gas costs will be populated after benchmarking on reference hardware.
- Repository setup and technical specification
-
ternary-backend: TernaryBackend trait + portable implementation -
ternary-backend: SIMD backend (AVX2) -
troika: Troika sponge construction with test vectors -
troika: Troika-243 and Troika-384 output modes -
lattice: NTRU key encapsulation mechanism -
lattice: Ternary Dilithium signature scheme -
parakeet-crypto: Facade crate with prelude - Criterion benchmarks + gas cost model
- Integration with Parakeet-Code (audit log hashing)
parakeet-crypto is a foundational library for:
- Parakeet-Code — Sovereign agentic CLI coder (integrity verification)
- BREEZE OS — Balanced ternary AI operating system (native ternary hardware target)
- Eclipse Gold — Developer social platform (post-quantum secure communication)
GPLv3 — see LICENSE for details.