Skip to main content

Quantum-resistant hash functions and post-quantum cryptography for blockchain

Project description

Dirac Hashes

A next-generation cryptographic hash library built for speed, security, and quantum resistance.

About

Dirac Hashes is a project aimed at developing and testing high-performance cryptographic hash functions that are resistant to quantum computing attacks. This repository contains a Python package implementing quantum-resistant hash functions, digital signature schemes, and key encapsulation mechanisms (KEM), plus tools for testing and comparing their performance.

Features

  • Quantum-resistant hash algorithms:
    • Improved (default, recommended)
    • Grover
    • Shor
    • Hybrid
    • Improved Grover
    • Improved Shor
  • Post-quantum signature schemes:
    • Dilithium (NIST standard)
    • SPHINCS+
    • Lamport
  • Key Encapsulation Mechanisms (KEM):
    • Kyber (NIST standard)
  • Web-based testing interface with performance visualization
  • Simple Python API for integration into other projects

Installation

Python Package

Install the package from PyPI:

pip install dirac-hashes

Or install from source:

git clone https://github.com/your-username/dirac-hashes.git
cd dirac-hashes
pip install -e .

Web Interface

To run the web interface locally:

  1. Clone this repository:

    git clone https://github.com/your-username/dirac-hashes.git
    cd dirac-hashes
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the server:

    python run_api.py
    
  4. Open http://localhost:8000 in your browser

Quick Start

from quantum_hash.dirac import DiracHash
from quantum_hash.signatures.dilithium import DilithiumSignature

# Generate a hash
message = "Hello, quantum world!"
hash_value = DiracHash.hash(message)
print(f"Hash: {hash_value.hex()}")

# Generate a key pair
dilithium = DilithiumSignature()
private_key, public_key = dilithium.generate_keypair()

# Sign a message
signature = dilithium.sign(message.encode(), private_key)

# Verify the signature
is_valid = dilithium.verify(message.encode(), signature, public_key)
print(f"Signature valid: {is_valid}")

For more examples, see the examples directory.

Project Structure

dirac-hashes/
├── api/                     # FastAPI backend
├── examples/                # Example scripts
├── frontend/                # Web interface
├── src/                     # Python package source
│   └── quantum_hash/        # Main package
│       ├── core/            # Core algorithms
│       ├── signatures/      # Signature schemes
│       ├── kem/             # Key encapsulation
│       └── utils/           # Utility functions
├── tests/                   # Test suite
├── README.md                # This file
└── setup.py                 # Package setup

Documentation

For detailed documentation, see the frontend/documentation page or visit our online documentation.

Future Development

  • Implementation of Dirac hash algorithms in Rust and WebAssembly
  • Integration with Solana blockchain for high-performance verification
  • Command-line tools for batch processing
  • Integration tests for cryptographic properties

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirac_hashes-0.1.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dirac_hashes-0.1.0-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

Details for the file dirac_hashes-0.1.0.tar.gz.

File metadata

  • Download URL: dirac_hashes-0.1.0.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dirac_hashes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d6b52dc417ab1b5c9d78f8403202fac2d80f61f8c04c1b9d9da3ec3fc92d0fb3
MD5 d9a21a2119aed1aa47f19e798ad9e2b9
BLAKE2b-256 b989568a08ec2c840b42014d330a478e4808bdc92ce2824ff00a203f699b4d08

See more details on using hashes here.

File details

Details for the file dirac_hashes-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dirac_hashes-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dirac_hashes-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3ec1190a4aa905df5b38fd52657766cf678f2105542831076f6426e5b5a7abf
MD5 55b6f32aba8997e75be84981762d792a
BLAKE2b-256 e8c2731caacedebf30bce9bb7279d368009487953da2aaa64f3824b4df50915d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page