dirac-hashes

post quantum cryptography

🔒 Dirac Hashes drops quantum-powered keys so tough, even post-quantum hackers can't crack 'em.

We're future-proofing blockchains — locked, loaded, and ready for the quantum age.

Quantum ain't sci-fi anymore. It's our firewall

# Install via pip pip install dirac-hashes

What is Dirac Hashes?

Dirac Hashes is a quantum-resistant cryptographic library designed to secure your applications against both classical and quantum attacks. Our algorithms are designed with the future in mind, providing robust security that can withstand the computational power of quantum computers.

Key Features:

  • Quantum-Resistant Hash Functions - Multiple hash algorithms designed to resist quantum-computing attacks
  • Post-Quantum Signatures - Including Dilithium (NIST standard), SPHINCS+, and Lamport schemes
  • Key Encapsulation Mechanisms - For secure key exchange in a post-quantum world
  • Simple API - Easy to integrate into your existing applications and blockchain systems

Quick Start

# Install via pip pip install dirac-hashes # Basic usage from quantum_hash.dirac import DiracHash # Generate a hash message = b"Your message here" digest = DiracHash.hash(message, algorithm="improved") print(digest.hex())

Latest Benchmark Results

Our latest optimization efforts have resulted in significant performance improvements while maintaining strong security properties.

Performance
Security
Signatures

Hash Function Performance (MB/s)

Algorithm 16 bytes 64 bytes 256 bytes 1024 bytes 4096 bytes
improved 0.003 0.005 0.007 0.008 0.008
grover 0.023 0.094 0.362 1.421 5.857
shor 0.247 0.657 0.999 1.053 1.142
hybrid 0.021 0.080 0.253 0.608 0.957
SHA-256 42.667 165.161 519.797 1098.123 1488.102

Grover variant shows 10x performance improvement in our latest version.

Security Metrics

Algorithm Avalanche Effect Entropy Chi-Square Collisions
improved 49.93% 6.302 262.24 0
grover 49.31% 6.289 267.36 0
hybrid 50.13% 6.286 254.56 0
SHA-256 50.34% 6.296 246.88 0

All algorithms now exhibit near-ideal avalanche effect of ~50%.

Signature Performance

Scheme Variant Key Gen Time Sign Time Verify Time Signature Size
Lamport grover 0.673s 0.001s 0.043s 2.2 KB
Dilithium level1 0.109s 0.284s ~0s 3.2 KB
SPHINCS+ default 5.346s 28.340s 24.922s 8.2 KB

Dilithium offers the best overall performance, while Lamport provides fastest signing operations.

Backend Stats

API Status & Performance

API is checking... (Response time: --)

Endpoint Statuses

Endpoint Status Response Time
hash Checking... --
signatures Checking... --
kem Checking... --

Documentation

Installation & Usage

Installation

# Install from PyPI pip install dirac-hashes # Or directly from the repository git clone https://github.com/yourusername/dirac-hashes.git cd dirac-hashes pip install -e .

Basic Usage

The core functionality is divided into three main modules:

1. Hash Functions

from quantum_hash.dirac import DiracHash # Generate a hash with the default algorithm message = b"Your message here" digest = DiracHash.hash(message) # Use a specific algorithm digest = DiracHash.hash(message, algorithm="hybrid") hash_value = DiracHash.hash(message) print(f"Hash: {hash_value.hex()}") # Compare multiple hash algorithms algorithms = ["improved", "grover", "shor"] for algo in algorithms: hash_value = DiracHash.hash(message, algorithm=algo) print(f"{algo}: {hash_value.hex()}") # Get a list of available algorithms algorithms = DiracHash.get_supported_algorithms()

2. Digital Signatures

from quantum_hash.signatures.dilithium import DilithiumSignature # Create a signer signer = DilithiumSignature(security_level=1, hash_algorithm="improved") # Generate keypair private_key, public_key = signer.generate_keypair() # Sign a message message = b"Message to sign" signature = signer.sign(message, private_key) # Verify a signature is_valid = signer.verify(message, signature, public_key)

3. Key Encapsulation Mechanism (KEM)

from quantum_hash.kem.kyber import KyberKEM # Create a KEM instance kem = KyberKEM(security_level=1) # Generate keypair private_key, public_key = kem.generate_keypair() # Encapsulate - generates a shared secret and ciphertext shared_secret, ciphertext = kem.encapsulate(public_key) # Decapsulate - recovers the shared secret from ciphertext recovered_secret = kem.decapsulate(ciphertext, private_key) # Both shared_secret and recovered_secret should be identical assert shared_secret == recovered_secret

Test Hashes

Try our quantum-resistant hash functions

Generate Hash

Compare Hash Algorithms

Visualize Hash Comparison

View detailed performance and security metrics for our hash algorithms.

Performance Comparison

Security Metrics

Signatures

Post-quantum digital signatures

1. Generate Key Pair

2. Sign Message

3. Verify Signature

Verify the signature generated in the previous step.

Key Encapsulation

Post-quantum key exchange

1. Generate KEM Key Pair

2. Encapsulate Key

Generate a shared secret using the public key.

3. Decapsulate Key

Recover the shared secret using the private key and ciphertext.

Visualizations

Performance and Security Benchmarks

Comprehensive Benchmark Visualizations

Explore detailed visualizations of our quantum-resistant cryptographic primitives compared to classical algorithms.

Hash Performance
Hash Security
Signature Performance
Key & Signature Sizes

Hash Function Performance by Message Size

Grover variant shows 10x performance improvement in our latest version, now reaching 5.857 MB/s for large messages.

Hash Security Properties

All algorithms now exhibit near-ideal avalanche effect of ~50% and excellent entropy distribution.

Signature Scheme Performance

Dilithium offers the best overall performance, while Lamport provides fastest signing operations.

Key and Signature Sizes

Showing trade-offs between key sizes and signature sizes across different schemes.

Hash Algorithm Comparison

Quantum vs Classical Resistance

Speed vs Security Trade-off

Performance Over Time

Shows the 10x performance improvement for the Grover variant in the latest version compared to previous releases.

Interactive Comparisons

Select algorithms and parameters to compare:

Understanding Hash Algorithms

A comprehensive guide to Dirac Hashes and quantum-resistant cryptography

Hash Algorithm Basics

What is a cryptographic hash function?

A cryptographic hash function is a mathematical algorithm that transforms data of arbitrary size into a fixed-size output (hash value). Good hash functions have these properties:

  • One-way function: It's computationally infeasible to reverse the process to find the original input from the hash value.
  • Deterministic: The same input will always produce the same output, ensuring consistency across systems.
  • Collision-resistant: It's extremely difficult to find two different inputs that produce the same output hash.
  • Avalanche effect: A small change in input (even a single bit) results in a significantly different output (ideally changing about 50% of the output bits).
  • Pre-image resistance: Given a hash value h, it should be computationally infeasible to find any message m such that hash(m) = h.
  • Second pre-image resistance: Given an input m₁, it should be computationally infeasible to find another input m₂ ≠ m₁ such that hash(m₁) = hash(m₂).

Cryptographic hash functions are fundamental building blocks for numerous security applications, from digital signatures to password storage and blockchain technology.

How do quantum computers threaten traditional hash functions?

What makes Dirac Hashes quantum-resistant?

Dirac Hash Algorithms

What are the different Dirac hash algorithms?

How do the Dirac algorithms compare in performance?

Which security levels are available?

Practical Considerations

When should I use each algorithm?

How can I interpret the performance and security graphs?

Can I drop in Dirac Hashes as a replacement for SHA-256?