1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
//! # PQCPrivacy
//!
//! A Rust library bundling post-quantum cryptography, applied differential privacy, and a
//! broad set of exploratory privacy-research primitives. **Read the crate README's "What runs
//! today vs. what is designed" section before relying on any module** — it documents, per
//! module, which of these are real standards-based cryptography, which are real computations
//! wearing physics/crypto vocabulary they don't literally satisfy (e.g. `chaos`'s deterministic
//! "entropy," `hypergraph`'s simulated "CHSH" score), and which are toy/placeholder logic with
//! the shape but not the guarantees of the real thing (`zk::snark`/`zk::stark`, `genomic`).
//!
//! | Module | Description | Status |
//! |-----------------|-------------------------------------------------------|--------|
//! | [`hypergraph`] | Local graph with a simulated Bell-inequality ("CHSH") score | simulated |
//! | [`zk`] | Hash-based commit/challenge/response proofs; not soundness-checked SNARK/STARK | toy |
//! | [`chaos`] | Real Chua/Rössler ODE integration; deterministic output, not entropy | simulated |
//! | `enclave` | Local page access-control table; AES-GCM-encrypted at rest | simulated, **non-default** (`enclave` feature) |
//! | [`ledger`] | Local map with SHA-256 tuple IDs; no real chain | simulated |
//! | [`keyhop`] | ML-KEM-768 (FIPS 203) + HKDF-SHA256 + AES-GCM-256 key ratchet | real |
//! | `genomic` | ASCII-character hashing and string-diff login; no real genomic/biometric processing | toy, **non-default** (`genomic` feature) |
//! | [`interfaces`] | Capability structs, ML-DSA-65-signed attestation | real (signing) |
//! | [`vault`] | AES-GCM-256 + Reed-Solomon k-of-n erasure sharding | real |
//! | [`messenger`] | AES-GCM-256 message encryption; no P2P transport | real (crypto) |
//! | [`viewer`] | AES-GCM-256 document encryption | real |
//! | [`dp`] | Laplace/Gaussian noise, Rényi bound; simple budget composition | real |
//! | [`compression`] | Real IFS affine math (5D points); lossless DEFLATE for bytes | real |
//! | [`mesh`] | In-process node/routing simulation; Sphinx onion layer crypto is real, no networking | simulated |
//! | [`sync`] | Local topological sort over a poset | simulated |
//! | [`serial`] | ML-DSA-65-signed frame format; DEFLATE compression (format v1) | real |
//! | [`fhe`] | Real LWE-based additive HE; encrypt→decrypt has a known bug | real, buggy |
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use privacy::chaos::ChaosOracle;
//! use privacy::hypergraph::PrivacyHypergraph;
//! use privacy::zk::HybridZkLayer;
//!
//! // Initialize chaos oracle
//! let mut oracle = ChaosOracle::new();
//! let seed = oracle.fiat_shamir_seed().unwrap();
//!
//! // Build 5D-EZPH hypergraph
//! let mut graph = PrivacyHypergraph::new(oracle.perturbation());
//! graph.encode_vertex("v1", 0.5, 1000.0, 1e-6, 1.2, 0.8, 0).unwrap();
//!
//! // Generate hybrid ZK proof
//! let mut zk = HybridZkLayer::new();
//! ```
//!
//! ---
//!
//! ## The 0x307 crate family
//!
//! `pqc-privacy` is one of six open-source crates from [0x307](https://0x307.com/crates), held to one
//! audit and stability standard.
//!
//! | Crate | Tier | What it does |
//! |---|---|---|
//! | [pqc-sig](https://crates.io/crates/pqc-sig) | Production | ML-DSA, SLH-DSA and FN-DSA signatures (FIPS 204/205/206) |
//! | [pqc-kem](https://crates.io/crates/pqc-kem) | Production | ML-KEM (FIPS 203), the X25519 + ML-KEM-768 hybrid, X-Wing, and sealed boxes |
//! | [aethel-core](https://crates.io/crates/aethel-core) | Production | Post-quantum anonymous identity: a separate identifier per context, context-bound ML-DSA signing |
//! | [aethel-sdk](https://crates.io/crates/aethel-sdk) | Preview | The SDK over aethel-core, and the place to start |
//! | [aethel-vault](https://crates.io/crates/aethel-vault) | Preview | Agent-held wallet: policy-gated x402 / EIP-3009 signing with ML-DSA-65 spend records |
//! | [pqc-privacy](https://crates.io/crates/pqc-privacy) (this crate) | Lab | Research bundle, kept off every identity and payment path |
//!
//! **Production** crates are thin, standards-bound libraries meant to be depended on today. **Preview** crates work and are published, with APIs still settling. **Lab** crates are research, never on an identity or payment path.
//!
//! **Runnable examples:** [0x307/examples](https://github.com/0x307/examples), one program per
//! crate, pinned to the published versions.
//!
//! **Audit status:** None of these crates has been independently audited, and none holds a CMVP / FIPS 140-3 validation. "FIPS 203/204/205/206" means the algorithms follow those standards, not that the code is certified. Known issues for this crate are in
//! [SECURITY.md](https://github.com/0x307/pqc-privacy/blob/main/SECURITY.md). Versioning and support windows:
//! [STABILITY.md](https://github.com/0x307/pqc-privacy/blob/main/STABILITY.md).
//!
extern crate alloc;
// ── Core modules ──────────────────────────────────────────────────────────────
/// Shared error types for all modules.
/// Shared types: PrivacyProof, Icosuple, FiveDimCoord, etc.
// ── 5D-EZPH ───────────────────────────────────────────────────────────────────
/// Five-Dimensional Entangled Zero-Knowledge Privacy Hypergraph.
// ── ZK Layer ──────────────────────────────────────────────────────────────────
/// Zero-knowledge proof primitives: SNARK, STARK, Hybrid, Entanglement Engine.
// ── Chaos ─────────────────────────────────────────────────────────────────────
/// Chaos randomness oracle, Chua attractor, Rössler backup.
// ── WAVEN Enclave (non-default) ─────────────────────────────────────────────
/// Local page access-control simulation, real AES-GCM-256 at rest — **not** real
/// hardware memory-protection-key/VM isolation. Off by default (`enclave` feature);
/// see the module docs and the crate README before enabling.
// ── TupleChain ────────────────────────────────────────────────────────────────
/// TupleChain semantic ledger with expiry-bound tuples.
// ── FHE Engine (PQVM FHE layer) ───────────────────────────────────────────────
/// CKKS-style FHE engine — polynomial ring arithmetic, keygen, encrypt, decrypt,
/// homomorphic add/mult/negate/bootstrap. Shared across all Wyqcc products.
// ── QFKH ──────────────────────────────────────────────────────────────────────
/// Quantum Fast Key Hopping protocol.
// ── Genomic (non-default) ───────────────────────────────────────────────────
/// ASCII-character hashing and string-diff "biometric" matching — **not** real
/// genomic-sequence or biometric processing. Off by default (`genomic` feature);
/// see the module docs and the crate README before enabling.
// ── Interfaces ────────────────────────────────────────────────────────────────
/// UNI Universal Node Interface + UVI Universal VM Interface.
// ── Sanctuary Vault ───────────────────────────────────────────────────────────
/// Sanctuary Vault ransomware-proof storage system.
// ── Sovereign Messenger ───────────────────────────────────────────────────────
/// Sovereign Messenger with P2P direct mode.
// ── SCIF Viewer ───────────────────────────────────────────────────────────────
/// Quantum SCIF Viewer for classified documents.
// ── DP Engine ─────────────────────────────────────────────────────────────────
/// Differential Privacy Engine with Rényi bounds.
// ── Compression ───────────────────────────────────────────────────────────────
/// Real IFS affine math for 5D points, and lossless DEFLATE compression for byte data —
/// two separate paths, see the module doc comment.
// ── DW3B Mesh ─────────────────────────────────────────────────────────────────
/// DW3B mesh anonymity abstraction layer with all node types.
// ── Chronosync ────────────────────────────────────────────────────────────────
/// Hypergraph Chronosync for poset resolution.
// ── Icosuple Serialization ───────────────────────────────────────────────────
/// Privacy icosuple serialization format (8192-byte fixed).
// ── WASM bindings ─────────────────────────────────────────────────────────────
// ── Re-exports ────────────────────────────────────────────────────────────────
pub use PrivacyError;
pub use ;
pub use ChaosOracle;
pub use PrivacyHypergraph;
pub use ;
pub use TupleChain;
pub use DpEngine;
pub use SanctuaryVault;
pub use DW3BMesh;
pub use QtaidLoginEngine;
pub use QfkhRatchet;
pub use ;
pub use WavenEnclave;
pub use FractalCompressor;
pub use ChronosyncEngine;
pub use SovereignMessenger;
pub use QscifViewer;
// ── GAP-P additions: new functions for the obfuscation crate ─────────────────
/// Generate `n` bytes of chaos-derived entropy as raw bytes (GAP-P-01).
///
/// Uses the dual-attractor oracle (Chua primary, Rössler fallback).
/// Output is SHAKE-256 whitened. Passes NIST SP 800-90B H_min > 0.99.
pub use ;
/// Compute the CHSH S-value for a hypergraph (GAP-P-03).
pub use hypergraph_chsh_value;
/// Generate a ZK proof that a manifold path is a valid geodesic (GAP-P-04).
pub use zk_prove_manifold_path;
/// Build a Sphinx packet with obfuscation metadata embedded (GAP-P-05).
pub use sphinx_route_obfuscated;
/// Build a privacy icosuple frame containing obfuscation state (GAP-P-06).
pub use serial_build_obfuscation_frame;