Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ML DSA #2

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 76 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ categories = ["cryptography", "post-quantum-cryptography"]

[dependencies]
rand = "0.7.3"
sha2 = "0.10.8"

[dev-dependencies]
criterion = { version = "0.4", features = ["html_reports"] }

[[bench]]
name = "dilithium_benchmarks"
harness = false
harness = false
2 changes: 1 addition & 1 deletion benches/dilithium_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use criterion::{Criterion, criterion_group};

mod dilithium_benches {
use dilithium::dilithium2::Keypair;
use crystals_dilithium::dilithium2::Keypair;

use super::*;

Expand Down
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod ml_dsa_44;
pub mod ml_dsa_65;
pub mod ml_dsa_87;
pub mod dilithium2;
pub mod dilithium3;
pub mod dilithium5;
Expand All @@ -11,6 +14,24 @@ pub mod rounding;
pub mod reduce;
pub mod sign;

pub enum PH {
SHA256,
SHA512,
}

use rand::RngCore;
/// Generate random bytes.
///
/// # Arguments
///
/// * 'bytes' - an array to fill with random data
/// * 'n' - number of bytes to generate
fn random_bytes(bytes: &mut [u8], n: usize) {
rand::prelude::thread_rng()
.try_fill_bytes(&mut bytes[..n])
.unwrap();
}

#[cfg(test)]
mod tests {
#[test]
Expand Down
Loading