How saudadeeee/zk-snark-x-steganography works
Project type and purpose
• This is an open-source Python + Circom tool/library for ZK-SNARK–based steganography.
• Purpose: embed messages (or metadata) into images using chaos-based LSB steganography, generate succinct zero-knowledge proofs (Groth16 via Circom/WASM), and pack everything into a PNG container.
• Key use cases: forensic integrity, copyright watermarking, private communication.
File structure
• Top-level directories:
• Demo/ (quick-start, step-by-step, benchmarks)
• artifacts/keys/ (Powers of Tau ptau, verification_key.json)
• bin/ (Circom compiler wrapper)
• circuits/ (source .circom + compiled R1CS, WASM, ZKey)
• comparative_benchmarks/, scientific_benchmarks/ (analysis scripts & reports)
• examples/testvectors/ (cover images)
• src/zk_stego/ (ChaosEmbedding, ZKProofGenerator, HybridProofArtifact)
• verify_zk_stego.py (CLI verification tool)
• zk-schnorr/ (separate ZK Schnorr stego experiment)
README for insights
• Four logical layers are described:
1) ZK Circuit layer (chaos_zk_stego.circom) with 32 constraints
2) ZK Proof layer (zk_proof_generator.py) automating witness + trusted setup + proof
3) Steganography layer (chaos_embedding.py) with Arnold Cat Map & Logistic Map + LSB
4) Integration layer (hybrid_proof_artifact.py) combining PNG chunk metadata + proof
• Circuits & Compiler: circuits/source/chaos_zk_stego.circom → R1CS, WASM via circom
• Trusted Setup: pot12_final.ptau + R1CS → .zkey → export verification_key.json
• ZK Proof Generator: Python class → generate witness (WASM) → snarkjs prove → proof JSON
• Chaos Embedding: Python class → Arnold Cat Map + Logistic Map → LSB modify image
• Hybrid Integration: Python class → embed proof & public inputs into PNG chunks
• CLI & Demos: verify_zk_stego.py, Demo scripts, benchmarks
• Cover image + message → ChaosEmbedding → stego-image raw
• Chaos params + trace → WASM witness generator → witness
• witness + .zkey → Groth16 prover → proof JSON + public inputs
• proof + public inputs → HybridProofArtifact → final PNG (custom chunks: stEg, tEXt)
• verify flow: final PNG → CLI tool → extract chunks → call snarkjs verify → PASS/FAIL
c. Architectural patterns & design principles:
• Layered separation of concerns (Circuit vs. Proof vs. Embedding vs. Integration)
• Modular code in src/zk_stego
• Reusable Circom circuits independent of Python logic
• Clear artifact management (artifacts/keys, circuits/compiled/build)
d. Relevant technologies & libraries:
• Circom compiler & snarkjs (Node.js, WASM)
• Python (PIL, numpy, hashlib)
• Groth16 proving system
• Demo & benchmark frameworks (matplotlib, CSV/JSON outputs)
Essential details
• Constraint count (32), proof size (739 bytes), performance metrics (embed <0.01s, proof gen ≈2.3s, verify ≈0.5s).
• Trusted setup workflow separately: ptau download → circuit setup → zkey → export verification key.
• PNG chunk structure: standard chunks + custom stEg/tEXt for proof & metadata.