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.
cargo build --release
use dilithium2::Keypair;
let keypair = Keypair::generate(Some(&seed));
let signature = keypair.sign(&msg);
let is_verified = keypair.public.verify(&msg, &signature);
cargo test
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 |
cargo doc --open
By contributing to this repository, you agree that your contributions will be licensed under the GPLv3 License.