labrador/core/
env_params.rs

1use crate::ring::zq::Zq;
2
3// Example Environment parameters used for LaBRADOR, can be expanded as required by testing.
4pub struct EnvironmentParameters {
5    // r is the number of witness elements, multiplicity
6    pub r: usize,
7    // n is the witness sizes, rank
8    pub n: usize,
9    // witness norm bound beta
10    pub beta: Zq,
11    // decompose base b
12    pub b: Zq,
13    // the parts of decomposition.
14    // t_1
15    pub t_1: usize,
16    // t_2
17    pub t_2: usize,
18    // kappa k, the example size, 128/log_q
19    pub k: usize,
20    pub k_1: usize,
21    pub k_2: usize,
22    // security level, \lambda = 128, lambda2 = 2 * lambda
23    pub lambda2: usize,
24    // the log of modulus q, q = 2^(32)
25    pub log_q: usize,
26    // random Eqlynomial degree bound
27    pub deg_bound_d: usize,
28
29    // L: F' functions family size, K: F functions family size
30    pub constraint_l: usize,
31    pub constraint_k: usize,
32}
33
34#[allow(clippy::too_many_arguments)]
35impl EnvironmentParameters {
36    pub fn new(
37        r: usize,
38        n: usize,
39        beta: Zq,
40        b: Zq,
41        t_1: usize,
42        t_2: usize,
43        k: usize,
44        k_1: usize,
45        k_2: usize,
46        lambda2: usize,
47        log_q: usize,
48        deg_bound_d: usize,
49        constraint_l: usize,
50        constraint_k: usize,
51    ) -> Self {
52        Self {
53            r,
54            n,
55            beta,
56            b,
57            t_1,
58            t_2,
59            k,
60            k_1,
61            k_2,
62            lambda2,
63            log_q,
64            deg_bound_d,
65            constraint_l,
66            constraint_k,
67        }
68    }
69}
70
71impl Default for EnvironmentParameters {
72    fn default() -> Self {
73        Self {
74            r: 3,
75            n: 5,
76            beta: Zq::new(65535),
77            b: Zq::new(16),
78            t_1: 4,
79            t_2: 4,
80            k: 4,
81            k_1: 5,
82            k_2: 5,
83            lambda2: 256,
84            log_q: 32,
85            deg_bound_d: 64,
86            constraint_l: 5,
87            constraint_k: 5,
88        }
89    }
90}