Skip to content

Commit

Permalink
Put arithmetic in its own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rozbb committed Jun 23, 2024
1 parent 532552a commit 121e17d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! Contains modules for ring and matrix arithmetic

mod matrix_arith;
mod ring_arith;

// Export all the underlying types
pub(crate) use matrix_arith::*;
pub(crate) use ring_arith::*;
2 changes: 1 addition & 1 deletion src/matrix_arith.rs → src/arithmetic/matrix_arith.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This file defines and implements matrices over our ring

use crate::{consts::RING_DEG, ring_arith::RingElem};
use crate::{arithmetic::RingElem, consts::RING_DEG};

/// An element of R^{x×y} where R is a [`RingElem`], stored in row-major order
// We store the matrix in row-major order, so the outer array is the number of rows, i.e., the
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/gen.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! This file implements methods for generating uniform matrices and binomially distributed vectors

use crate::{
arithmetic::{Matrix, RingElem},
consts::{MAX_MU, MODULUS_Q_BITS, RING_DEG},
matrix_arith::Matrix,
ring_arith::RingElem,
ser::deserialize,
};

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
)]
#![doc = include_str!("../README.md")]

mod arithmetic;
mod consts;
mod gen;
mod impls;
mod kem;
mod matrix_arith;
mod pke;
mod ring_arith;
mod ser;

pub extern crate kem as kem_traits;
Expand Down
3 changes: 1 addition & 2 deletions src/pke.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//! This file implements the IND-CPA-secure Saber.PKE scheme

use crate::{
arithmetic::{Matrix, RingElem},
consts::MAX_L,
consts::MAX_MODULUS_T_BITS,
consts::{MODULUS_P_BITS, MODULUS_Q_BITS, RING_DEG},
gen::{gen_matrix_from_seed, gen_secret_from_seed},
matrix_arith::Matrix,
ring_arith::RingElem,
ser::deserialize,
};

Expand Down

0 comments on commit 121e17d

Please sign in to comment.