kopis/consts.rs
1/// The bitlength of the modulus q = 2^13
2pub(crate) const MODULUS_Q_BITS: usize = 13;
3/// The bitlength of the modulus p = 2^10
4pub(crate) const MODULUS_P_BITS: usize = 10;
5/// The degree of the polynomial ring over Z/qZ
6pub(crate) const RING_DEG: usize = 256;
7
8// Key for the following constants:
9// * L is the dimension of the vectors/matrices we use.
10// E.g., a secret in Kopis-512 is an element of R_q^2
11// * MODULUS_T_BITS is the modulus for some ciphertext values.
12// E.g., the c values in Kopis-512 are in R_3
13// * MU is roughly the width of the binomial distribution we sample from.
14// E.g., in Kopis-512, we sample from a binomial distribution with width 10
15
16pub(crate) const KOPIS512_L: usize = 2;
17pub(crate) const KOPIS512_T: usize = 3;
18pub(crate) const KOPIS512_MU: usize = 10;
19
20pub(crate) const KOPIS768_L: usize = 3;
21pub(crate) const KOPIS768_T: usize = 4;
22pub(crate) const KOPIS768_MU: usize = 8;
23
24pub(crate) const KOPIS1024_L: usize = 4;
25pub(crate) const KOPIS1024_T: usize = 6;
26pub(crate) const KOPIS1024_MU: usize = 6;
27
28// We need to store maximum values because we can't do const arithmetic on some buffer sizes
29
30/// The maximum possible μ value is μ=10, set by Kopis-512
31pub(crate) const MAX_MU: usize = 10;
32
33/// The maximum possible l value is l=4, set by Kopis-1024
34pub(crate) const MAX_L: usize = 4;
35
36/// The maximum possible log(T) value is T=6, set by Kopis-1024
37pub(crate) const MAX_T: usize = 6;
38
39// Domain separators for TurboSHAKE invocations
40pub(crate) const DOMSEP_KGEXPAND: u8 = 0x01;
41pub(crate) const DOMSEP_GENMAT: u8 = 0x02;
42pub(crate) const DOMSEP_GENSEC: u8 = 0x03;
43pub(crate) const DOMSEP_PKHASH: u8 = 0x04;
44pub(crate) const DOMSEP_FO: u8 = 0x05;
45pub(crate) const DOMSEP_NOREJECT: u8 = 0x06;