qzkp

Secure Quantum Zero-Knowledge Proofs: Implementation, Analysis, and Optimization

https://github.com/hydraresearch/qzkp

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.5%) to scientific vocabulary

Keywords

academic cryptographic-proofs cryptographic-security cryptography dilithium-blake3 golang golang-library information-security post-quantum-cryptography quantum-algorithms quantum-computing quantum-cryptography quantum-information quantum-protocols research security soundness-analysis zero-knowledge zero-knowledge-proof zkp
Last synced: 6 months ago · JSON representation

Repository

Secure Quantum Zero-Knowledge Proofs: Implementation, Analysis, and Optimization

Basic Info
  • Host: GitHub
  • Owner: hydraresearch
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 266 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
academic cryptographic-proofs cryptographic-security cryptography dilithium-blake3 golang golang-library information-security post-quantum-cryptography quantum-algorithms quantum-computing quantum-cryptography quantum-information quantum-protocols research security soundness-analysis zero-knowledge zero-knowledge-proof zkp
Created 9 months ago · Last pushed 9 months ago
Metadata Files
Readme License Citation Security

README.md

Quantum Zero-Knowledge Proof (QZKP) Implementation

Author: Nick Cloutier

ORCID: 0009-0008-5289-5324

GitHub: https://github.com/nicksdigital/

Affiliation: Hydra Research & Labs

Date: May 24th, 2025

A comprehensive Go implementation of quantum zero-knowledge proofs with post-quantum cryptographic security.

CRITICAL SECURITY NOTICE

This implementation provides TWO different proof systems:

  1. ** INSECURE Implementation** (QuantumZKP) - DO NOT USE IN PRODUCTION

    • Leaks complete state vector information
    • For educational/comparison purposes only
  2. ** SECURE Implementation** (SecureQuantumZKP) - PRODUCTION READY

    • True zero-knowledge properties
    • No information leakage
    • Post-quantum secure

Repository Structure

Documentation (/docs/)

  • /academic/ - Research papers and formal documentation
  • /evidence/ - Proof of real quantum hardware execution
  • /research/ - Complete 8-year research timeline
  • /articles/ - Public articles and media content

Implementation

  • Go files - Core quantum cryptography implementation
  • Python files - IBM Quantum integration and testing
  • JSON files - Quantum execution results and data

Table of Contents

Installation

```bash

Clone the repository

git clone cd quantumzkp

Initialize Go module

go mod init quantumzkp go mod tidy

Run tests

go test -v ```

Quick Start

Basic Secure Proof Generation

```go package main

import ( "fmt" "log" )

func main() { // Initialize secure quantum ZKP system ctx := []byte("my-application-context") sq, err := NewSecureQuantumZKP(3, 128, ctx) if err != nil { log.Fatal(err) }

// Secret quantum state vector
secretVector := []complex128{
    complex(0.7071, 0),    // |0 component
    complex(0.7071, 0),    // |1 component
    complex(0, 0),         // |2 component
    complex(0, 0),         // |3 component
}

// Generate secure proof
identifier := "my-secret-state"
key := []byte("32-byte-key-for-authentication!!")

proof, err := sq.SecureProveVectorKnowledge(secretVector, identifier, key)
if err != nil {
    log.Fatal(err)
}

// Verify proof (without learning the secret!)
isValid := sq.VerifySecureProof(proof, key)
fmt.Printf("Proof valid: %v\n", isValid)

// The proof contains NO information about secretVector!
fmt.Printf("Proof size: %d bytes\n", len(mustMarshal(proof)))

} ```

Proof from Arbitrary Data

```go // Convert any data to quantum state and prove knowledge secretData := []byte("This is my secret document content") identifier := "document-proof" key := []byte("32-byte-key-for-authentication!!")

// Generate proof directly from bytes proof, err := sq.SecureProveFromBytes(secretData, identifier, key) if err != nil { log.Fatal(err) }

// Verify without learning anything about secretData isValid := sq.VerifySecureProof(proof, key) fmt.Printf("Document proof valid: %v\n", isValid) ```

API Reference

SecureQuantumZKP

The main secure implementation for production use.

Constructor

go func NewSecureQuantumZKP(dimensions, securityLevel int, ctx []byte) (*SecureQuantumZKP, error)

  • dimensions: Quantum system dimensions (typically 3-8)
  • securityLevel: Security level in bits (128, 192, or 256)
  • ctx: Application context for domain separation

Core Methods

```go // Generate proof from quantum state vector func (sq SecureQuantumZKP) SecureProveVectorKnowledge( vector []complex128, identifier string, key []byte, ) (SecureProof, error)

// Generate proof from arbitrary bytes func (sq SecureQuantumZKP) SecureProveFromBytes( data []byte, identifier string, key []byte, ) (SecureProof, error)

// Verify proof without learning the secret func (sq *SecureQuantumZKP) VerifySecureProof( proof *SecureProof, key []byte, ) bool ```

Quantum Circuit Operations

```go // Build quantum circuit from state vector func (q QuantumZKP) BuildCircuit(vector []complex128, identifier string) (QuantumCircuit, error)

// Optimize circuit for execution func (q QuantumZKP) TranspileCircuit(circuit *QuantumCircuit, optimizationLevel int) (QuantumCircuit, error)

// Apply noise mitigation techniques func (q QuantumZKP) ApplyNoiseMitigation(circuit *QuantumCircuit) (QuantumCircuit, error)

// Execute circuit simulation func (q QuantumZKP) ExecuteCircuit(circuit *QuantumCircuit, shots int) (ExecutionResult, error) ```

Utility Functions

```go // Convert bytes to normalized quantum state vector func BytesToState(data []byte, targetSize int) ([]complex128, error)

// Create quantum state vector with properties func NewQuantumStateVector(coordinates []complex128) *QuantumStateVector ```

Security Analysis

Information Leakage Comparison

| Implementation | State Vector Leakage | Measurement Leakage | Metadata Leakage | Proof Size | Security | |---------------|---------------------|-------------------|------------------|------------|----------| | Insecure | Complete exposure | Direct probabilities | Exact values | ~10KB | None | | Secure (80-bit) | Zero leakage | Cryptographic commitments | Upper bounds only | ~20KB | Production ready |

Security Properties

The secure implementation provides:

  • Zero-Knowledge: Verifier learns nothing about the secret state
  • Soundness: Invalid proofs are rejected with high probability
  • Completeness: Valid proofs are accepted with high probability
  • Post-Quantum Security: Resistant to quantum computer attacks

Cryptographic Primitives

  • Signatures: Dilithium (NIST post-quantum standard)
  • Hashing: SHA-256 and BLAKE3 (quantum-resistant)
  • Commitments: Cryptographic hash-based commitments
  • Randomness: Cryptographically secure random number generation

Standards Compliance

  • NIST Post-Quantum Cryptography: Compliant with NIST standards
  • FIPS 140-2: Uses FIPS-approved cryptographic algorithms
  • BSI TR-02102: Follows German Federal Office recommendations

Examples

Example 1: Basic Quantum State Proof

```go func ExampleBasicProof() { // Setup sq, _ := NewSecureQuantumZKP(3, 128, []byte("example-context"))

// Bell state: (|00 + |11)/2
bellState := []complex128{
    complex(0.7071, 0), // |00
    complex(0, 0),      // |01
    complex(0, 0),      // |10
    complex(0.7071, 0), // |11
}

key := []byte("example-key-32-bytes-long!!!!")

// Generate proof
proof, err := sq.SecureProveVectorKnowledge(bellState, "bell-state", key)
if err != nil {
    panic(err)
}

// Verify
valid := sq.VerifySecureProof(proof, key)
fmt.Printf("Bell state proof valid: %v\n", valid)

// Proof contains no information about bellState components!

} ```

Example 2: Document Authentication

```go func ExampleDocumentAuth() { sq, _ := NewSecureQuantumZKP(3, 128, []byte("document-auth"))

// Secret document
document := []byte(`
    CONFIDENTIAL DOCUMENT
    Project: Quantum Cryptography
    Classification: Top Secret
    Content: [REDACTED]
`)

key := []byte("document-signing-key-32-bytes!!")

// Generate proof of document knowledge
proof, err := sq.SecureProveFromBytes(document, "doc-2024-001", key)
if err != nil {
    panic(err)
}

// Verify without revealing document content
valid := sq.VerifySecureProof(proof, key)
fmt.Printf("Document authentication: %v\n", valid)

// The proof reveals NOTHING about the document content!

} ```

Example 3: Quantum Circuit Analysis

```go func ExampleCircuitAnalysis() { q, _ := NewQuantumZKP(3, 128, []byte("circuit-context"))

// Superposition state
superpos := []complex128{
    complex(0.5, 0), complex(0.5, 0),
    complex(0.5, 0), complex(0.5, 0),
}

// Build and analyze quantum circuit
circuit, _ := q.BuildCircuit(superpos, "superposition-circuit")

// Optimize circuit
optimized, _ := q.TranspileCircuit(circuit, 3) // Max optimization

// Apply noise mitigation
mitigated, _ := q.ApplyNoiseMitigation(optimized)

// Execute circuit
result, _ := q.ExecuteCircuit(mitigated, 1000)

fmt.Printf("Circuit execution completed:\n")
fmt.Printf("- Shots: %d\n", result.Shots)
fmt.Printf("- Execution time: %.3f seconds\n", result.ExecutionTime)
fmt.Printf("- Measurement outcomes: %d unique\n", len(result.Counts))

} ```

Example 4: Security Demonstration

```go func ExampleSecurityDemo() { // Compare insecure vs secure implementations

secret := []complex128{complex(0.8, 0.2), complex(0.3, 0.5)}
key := []byte("demo-key-32-bytes-long-enough!!")

// INSECURE implementation (for comparison only)
q, _ := NewQuantumZKP(3, 128, []byte("demo"))
insecureProof, _ := q.Prove(secret, "demo", key)

// SECURE implementation
sq, _ := NewSecureQuantumZKP(3, 128, []byte("demo"))
secureProof, _ := sq.SecureProveVectorKnowledge(secret, "demo", key)

// Analyze information leakage
insecureJSON, _ := json.Marshal(insecureProof)
secureJSON, _ := json.Marshal(secureProof)

fmt.Printf("Security Analysis:\n")

// Check if secret components are visible
secretStr := fmt.Sprintf("%.1f", real(secret[0]))

if strings.Contains(string(insecureJSON), secretStr) {
    fmt.Printf(" INSECURE: Secret leaked in proof!\n")
}

if !strings.Contains(string(secureJSON), secretStr) {
    fmt.Printf(" SECURE: No secret leakage detected!\n")
}

fmt.Printf("Insecure proof size: %d bytes\n", len(insecureJSON))
fmt.Printf("Secure proof size: %d bytes\n", len(secureJSON))

} ```

Best Practices

Security Guidelines

  1. Always use SecureQuantumZKP for production systems
  2. Never use the insecure implementation except for educational purposes
  3. Use strong, unique keys (32 bytes minimum)
  4. Implement proper key management and rotation
  5. Validate all inputs before proof generation
  6. Use appropriate security levels (128-bit minimum for production)

Performance Optimization

  1. Choose appropriate dimensions (3-8 for most applications)
  2. Use circuit optimization for better performance
  3. Apply noise mitigation for quantum hardware deployment
  4. Cache quantum state vectors when possible
  5. Batch proof operations for better throughput

Error Handling

```go // Always check for errors proof, err := sq.SecureProveVectorKnowledge(vector, id, key) if err != nil { // Handle specific error types switch { case strings.Contains(err.Error(), "empty"): log.Error("Invalid input: empty vector") case strings.Contains(err.Error(), "key"): log.Error("Invalid key format") default: log.Error("Proof generation failed: %v", err) } return }

// Verify proof validity if !sq.VerifySecureProof(proof, key) { log.Error("Proof verification failed") return } ```

Testing

```bash

Run all tests

go test -v

Run security-specific tests

go test -v -run TestSecure

Run information leakage analysis

go test -v -run TestInformationLeakageAnalysis

Benchmark performance

go test -bench=. ```

License

This implementation is provided for educational and research purposes. Please ensure compliance with applicable laws and regulations when using cryptographic software.

References and Standards

Academic References

  • Watrous, J. (2009). Zero-knowledge against quantum attacks. SIAM Journal on Computing.
  • Broadbent, A., & Schaffner, C. (2016). Quantum cryptography beyond quantum key distribution.
  • Coladangelo, A., Vidick, T., & Zhang, T. (2020). Non-interactive zero-knowledge arguments for QMA.

Standards and Guidelines

  • NIST Post-Quantum Cryptography: https://csrc.nist.gov/projects/post-quantum-cryptography
  • CRYSTALS-Dilithium: https://pq-crystals.org/dilithium/
  • BLAKE3: https://github.com/BLAKE3-team/BLAKE3
  • BSI TR-02102: https://www.bsi.bund.de/EN/Themen/Unternehmen-und-Organisationen/Standards-und-Zertifizierung/Technische-Richtlinien/TR-nach-Thema-sortiert/tr02102/tr02102_node.html

Security Resources

  • Quantum Cryptography: https://www.etsi.org/technologies/quantum-safe-cryptography
  • Post-Quantum Security: https://blog.cloudflare.com/pq-2024/
  • NSA CNSA Suite: https://www.nsa.gov/Cybersecurity/Post-Quantum-Cybersecurity-Resources/

Contributing

Contributions are welcome! Please ensure all security-related changes are thoroughly reviewed and tested.

Disclaimer

This is a research implementation. For production use, conduct thorough security audits and consider formal verification of the zero-knowledge properties.

Owner

  • Name: hydraresearch
  • Login: hydraresearch
  • Kind: organization

GitHub Events

Total
  • Release event: 1
  • Watch event: 1
  • Push event: 15
  • Create event: 1
Last Year
  • Release event: 1
  • Watch event: 1
  • Push event: 15
  • Create event: 1

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
proxy.golang.org: github.com/hydraresearch/qzkp
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.2%
Dependent repos count: 5.6%
Average: 11.5%
Forks count: 17.2%
Stargazers count: 17.8%
Last synced: 6 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • actions/upload-artifact v4 composite
  • aquasecurity/trivy-action master composite
  • codecov/codecov-action v4 composite
  • docker/build-push-action v5 composite
  • docker/login-action v3 composite
  • docker/metadata-action v5 composite
  • docker/setup-buildx-action v3 composite
  • github/codeql-action/upload-sarif v3 composite
  • golangci/golangci-lint-action v6 composite
.github/workflows/release.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • softprops/action-gh-release v2 composite
Dockerfile docker
  • alpine latest build
  • builder latest build
  • golang 1.24-alpine build
go.mod go
  • github.com/cloudflare/circl v1.6.1
  • github.com/klauspost/cpuid/v2 v2.0.9
  • golang.org/x/sys v0.10.0
  • lukechampine.com/blake3 v1.4.1
go.sum go
  • github.com/cloudflare/circl v1.6.1
  • github.com/klauspost/cpuid/v2 v2.0.9
  • golang.org/x/sys v0.10.0
  • lukechampine.com/blake3 v1.4.1