MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / default

Method default

poly-commit/src/linear_codes/brakedown.rs:103–143  ·  view source on GitHub ↗

Create a default UniversalParams, with the values from Fig. 2 from the paper.

(
        rng: &mut R,
        poly_len: usize,
        check_well_formedness: bool,
        leaf_hash_param: LeafParam<C>,
        two_to_one_hash_param: TwoToOneParam<C>,
        col_hash_params: H:

Source from the content-addressed store, hash-verified

101{
102 /// Create a default UniversalParams, with the values from Fig. 2 from the paper.
103 pub fn default<R: RngCore>(
104 rng: &mut R,
105 poly_len: usize,
106 check_well_formedness: bool,
107 leaf_hash_param: LeafParam<C>,
108 two_to_one_hash_param: TwoToOneParam<C>,
109 col_hash_params: H::Parameters,
110 ) -> Self {
111 let sec_param = 128;
112 let a = (178, 1000);
113 let b = (61, 1000);
114 let r = (1521, 1000);
115 let base_len = 30;
116 let t = calculate_t::<F>(sec_param, (b.0 * r.1, b.1 * r.0), poly_len).unwrap(); // we want to get a rough idea what t is
117 let n = 1 << log2((ceil_div(2 * poly_len, t) as f64).sqrt().ceil() as usize);
118 let m = ceil_div(poly_len, n);
119 let c = Self::cn_const(a, b);
120 let d = Self::dn_const(a, b, r);
121 let ct = Constants { a, b, r, c, d };
122 let (a_dims, b_dims) = Self::mat_size(m, base_len, &ct);
123 let a_mats = Self::make_all(rng, &a_dims);
124 let b_mats = Self::make_all(rng, &b_dims);
125
126 Self::new(
127 sec_param,
128 a,
129 b,
130 r,
131 base_len,
132 n,
133 m,
134 a_dims,
135 b_dims,
136 a_mats,
137 b_mats,
138 check_well_formedness,
139 leaf_hash_param,
140 two_to_one_hash_param,
141 col_hash_params,
142 )
143 }
144
145 /// This function creates a UniversalParams. It does not check if the paramters are consistent/correct.
146 pub fn new(

Callers

nothing calls this directly

Calls 1

ceil_divFunction · 0.85

Tested by

no test coverage detected