#post-quantum-cryptography #post-quantum #key-exchange #quantum #signature-scheme #rust

bin+lib quantum_cryptographic_toolkit

A toolkit for developing, testing, and deploying quantum-resistant cryptographic algorithms

3 unstable releases

0.2.0 Sep 4, 2024
0.1.1 Aug 14, 2024
0.1.0 Aug 14, 2024

#1691 in Cryptography

Download history 191/week @ 2024-08-09 38/week @ 2024-08-16 112/week @ 2024-08-30 18/week @ 2024-09-06 43/week @ 2024-09-13 43/week @ 2024-09-20 26/week @ 2024-09-27 6/week @ 2024-10-04

120 downloads per month

MIT license

41KB
639 lines

Quantum Cryptographic Toolkit

DOI

Description

The Quantum Cryptographic Toolkit is a collection of tools and libraries written in Rust, designed to develop, test, and deploy quantum-resistant cryptographic algorithms. It supports several well-known quantum-safe algorithms, making it a powerful resource for post-quantum cryptography.

Project Structure

The project is structured as follows:

  • src/algorithms/: Contains implementations of various quantum-resistant cryptographic algorithms, including:

    • NewHope: Lattice-based key exchange.
    • SPHINCS+: Stateless hash-based digital signature scheme.
    • McEliece: Code-based cryptosystem.
    • SIKE: Supersingular isogeny-based key encapsulation mechanism.
    • FrodoKEM and Kyber (located in experimental): Lattice-based key encapsulation algorithms.
  • src/profiling/: Contains tools for profiling the performance of cryptographic algorithms.

  • src/core.rs: Core library functionality providing the main interface for interacting with the algorithms and profiling tools.

  • src/main.rs: Entry point for running algorithm demonstrations and profiling.

Usage

To use the toolkit, you can initialize the core library and run demonstrations or profiling as shown below:

use quantum_cryptographic_toolkit::core::CryptoToolkit;

fn main() {
    let toolkit = CryptoToolkit::new();
    toolkit.run_algorithm_demo();
    toolkit.profile_algorithms();
}

Example - Using NewHope Algorithm

Here’s a simple example that demonstrates how to use the NewHope algorithm for key exchange:

use quantum_cryptographic_toolkit::algorithms::newhope::NewHope;

fn main() {
    let newhope = NewHope::new();
    let public_key = vec![1, 2, 3, 4];
    let shared_secret = newhope.exchange(&public_key);
    println!("Shared secret: {:?}", shared_secret);
}

Installation

To include the Quantum Cryptographic Toolkit in your Rust project, add the following to your Cargo.toml:

[dependencies]
quantum_cryptographic_toolkit = { path = "path/to/quantum_cryptographic_toolkit" }

Ensure that you have all the necessary dependencies installed, and run cargo build to compile the project.

Running with Docker

You can also use Docker to containerize and run the toolkit. To build and run the Docker image:

podman build -t quantum_cryptographic_toolkit .
podman run --rm -it quantum_cryptographic_toolkit

This will build the Docker container and run the project inside an isolated environment.

Examples

The repository contains several examples that demonstrate how to use the various cryptographic algorithms. You can run them by using cargo run --example <example_name>. Examples include:

  • NewHope Example:

    cargo run --example newhope_example
    
  • SPHINCS+ Example:

    cargo run --example sphincs_example
    

Contributing

Contributions are welcome! Please follow the guidelines outlined in the CONTRIBUTING.md file. Contributions can include bug reports, feature requests, or even improvements to the cryptographic algorithms implemented.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Dependencies

~8–18MB
~252K SLoC