crystals-dilithium

Crates.iocrystals-dilithium
lib.rscrystals-dilithium
version1.0.0
sourcesrc
created_at2023-07-04 17:57:04.849004
updated_at2023-07-04 17:57:04.849004
descriptionPure RUST implementation of CRYSTALS-Dilithium digital signature scheme
homepagehttps://www.quantumblockchains.io/
repositoryhttps://github.com/Quantum-Blockchains/dilithium
max_upload_size
id908233
size736,300
(MagisterLeon)

documentation

README

CRYSTALS-Dilithium

Pure RUST implementation of CRYSTALS-Dilithium digital signature scheme in 3 variants:

  • dilithium2
  • dilithium3
  • dilithuim5.

The code was ported from the original reference source code provided by the authors of the algorithm.

The implementation takes advantage of RUST clean and safe memory management. The code is much cleaner and shorter compared to the original. The implementation was verified in two separate ways:

  • Cross-verification with the reference implementation, where signatures generated by the RUST implementation were successfully verified by the reference C-implementation, and signatures generated by the reference implementation were verified by the RUST implementation.
  • Self-verification, where signatures generated by the RUST implementation were verified by the RUST implementation itself. The verification was performed using the Monte Carlo methodology for random keys and random messages.

Use at Your Own Risk
This implementation of the CRYSTALS-Dilithium cryptographic algorithm has not yet undergone a formal security audit by a recognized authority. As a result, there may be unknown security vulnerabilities, weaknesses, or potential flaws in the code. Users are advised to exercise caution when implementing or using this code.


Build

cargo build --release

How to use

use dilithium2::Keypair;

let keypair = Keypair::generate(Some(&seed));
let signature = keypair.sign(&msg);
let is_verified = keypair.public.verify(&msg, &signature);

Test

cargo test

Benchmarks

Benchmarks are run using criterion.rs:

cargo bench

Running on 2,6 GHz 6-Core Intel Core i7

Benchmark time
keypair generation 83.548 µs
signing 137.19 µs
signature verification 57.331 µs

Docs

cargo doc --open

Contributor Agreement

By contributing to this repository, you agree that your contributions will be licensed under the GPLv3 License.

Commit count: 23

cargo fmt