Quantum-Blockchains / dilithium

Pure Rust implementation of of the post-quantum CRYSTALS-Dilithium algorithm
GNU General Public License v3.0
9 stars 1 forks source link

CRYSTALS-Dilithium

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

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:


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.