shamir.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2020-2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020-2021 Ilias Khairullin <ilias@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_PUBKEY_SHAMIR_SSS_HPP
27 #define CRYPTO3_PUBKEY_SHAMIR_SSS_HPP
28 
29 #include <vector>
30 #include <tuple>
31 #include <type_traits>
32 #include <unordered_map>
33 #include <unordered_set>
34 #include <iterator>
35 
36 #include <boost/assert.hpp>
37 #include <boost/concept_check.hpp>
38 
39 #include <boost/range/concepts.hpp>
40 
41 #include <nil/crypto3/random/algebraic_random_device.hpp>
42 
46 
51 
53 
54 namespace nil {
55  namespace crypto3 {
56  namespace pubkey {
57  template<typename Group>
58  struct shamir_sss : public sss_weighted_basic_policy<Group> {
59  typedef Group group_type;
61 
62  //===========================================================================
63  // secret sharing scheme output types
64 
65  typedef std::vector<typename basic_policy::coeff_type> coeffs_type;
66  typedef std::vector<typename basic_policy::public_coeff_type> public_coeffs_type;
67 
68  static inline typename basic_policy::private_element_type
69  eval_basis_poly(const typename basic_policy::indexes_type &indexes, std::size_t i) {
71 
72  typename basic_policy::private_element_type e_i(i);
73  typename basic_policy::private_element_type result = basic_policy::private_element_type::one();
74 
75  for (auto j : indexes) {
76  if (j != i) {
77  result = result * (typename basic_policy::private_element_type(j) /
78  (typename basic_policy::private_element_type(j) - e_i));
79  }
80  }
81  return result;
82  }
83 
84  //===========================================================================
85  // TODO: refactor
86  // polynomial generation functions
87 
88  static inline coeffs_type get_poly(std::size_t t, std::size_t n) {
90 
91  return get_poly(t);
92  }
93 
94  template<
95  typename Generator = random::algebraic_random_device<typename basic_policy::coeff_type::field_type>,
96  typename Distribution = void>
97  static inline coeffs_type get_poly(std::size_t t) {
99 
100  coeffs_type coeffs;
101  Generator gen;
102  for (std::size_t i = 0; i < t; i++) {
103  coeffs.emplace_back(gen());
104  }
105  return coeffs;
106  }
107 
108  //===========================================================================
109  // TODO: refactor
110  // general purposes functions
111 
112  template<typename Coeffs>
113  static inline public_coeffs_type get_public_coeffs(const Coeffs &coeffs) {
114  BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const Coeffs>));
115 
116  return get_public_coeffs(std::cbegin(coeffs), std::cend(coeffs));
117  }
118 
119  template<typename CoeffsIt>
120  static inline public_coeffs_type get_public_coeffs(CoeffsIt first, CoeffsIt last) {
121  BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<CoeffsIt>));
122  assert(basic_policy::check_minimal_size(std::distance(first, last)));
123 
124  public_coeffs_type public_coeffs;
125  for (auto it = first; it != last; it++) {
126  public_coeffs.emplace_back(basic_policy::get_public_element(*it));
127  }
128  return public_coeffs;
129  }
130  };
131 
132  template<typename Group>
133  struct public_share_sss<shamir_sss<Group>> {
137  typedef typename public_share_type::first_type index_type;
138  typedef typename public_share_type::second_type value_type;
139 
140  public_share_sss() = default;
141 
142  public_share_sss(std::size_t i) : public_share(i, public_share_type::second_type::zero()) {
143  assert(scheme_type::check_participant_index(get_index()));
144  }
145 
146  public_share_sss(const public_share_type &in_public_share) : public_share(in_public_share) {
147  assert(scheme_type::check_participant_index(get_index()));
148  }
149 
150  public_share_sss(std::size_t i, const typename public_share_type::second_type &ps) :
151  public_share(i, ps) {
152  assert(scheme_type::check_participant_index(get_index()));
153  }
154 
155  inline index_type get_index() const {
156  return public_share.first;
157  }
158 
159  inline const value_type &get_value() const {
160  return public_share.second;
161  }
162 
163  inline const data_type &get_data() const {
164  return public_share;
165  }
166 
167  bool operator==(const public_share_sss &other) const {
168  return this->public_share == other.public_share;
169  }
170 
171  bool operator<(const public_share_sss &other) const {
172  return this->get_index() < other.get_index();
173  }
174 
175  protected:
177  };
178 
179  template<typename Group>
180  struct share_sss<shamir_sss<Group>> {
184  typedef typename share_type::first_type index_type;
185  typedef typename share_type::second_type value_type;
186 
187  share_sss() = default;
188 
189  share_sss(std::size_t i) : share(i, share_type::second_type::zero()) {
190  assert(scheme_type::check_participant_index(get_index()));
191  }
192 
193  share_sss(const share_type &in_share) : share(in_share) {
194  assert(scheme_type::check_participant_index(get_index()));
195  }
196 
197  share_sss(std::size_t i, const typename share_type::second_type &s) : share(i, s) {
198  assert(scheme_type::check_participant_index(get_index()));
199  }
200 
201  inline index_type get_index() const {
202  return share.first;
203  }
204 
205  inline const value_type &get_value() const {
206  return share.second;
207  }
208 
209  inline const data_type &get_data() const {
210  return share;
211  }
212 
213  template<
214  typename Scheme,
215  typename std::enable_if<
216  std::is_convertible<typename std::remove_cv<typename std::remove_reference<Scheme>::type>::type,
217  scheme_type>::value,
218  bool>::type = true>
219  operator public_share_sss<Scheme>() const {
220  using To = public_share_sss<Scheme>;
221 
222  return To(share.first, share.second * To::public_share_type::second_type::one());
223  }
224 
225  bool operator==(const share_sss &other) const {
226  return this->share == other.share;
227  }
228 
229  bool operator<(const share_sss &other) const {
230  return this->get_index() < other.get_index();
231  }
232 
233  //
234  // 0 <= k < t
235  //
236  inline void update(const typename scheme_type::coeff_type &coeff, std::size_t exp) {
237  assert(scheme_type::check_exp(exp));
238 
239  share.second =
240  share.second + coeff * typename scheme_type::private_element_type(share.first).pow(exp);
241  }
242 
243  protected:
245  };
246 
247  template<typename Group>
248  struct public_secret_sss<shamir_sss<Group>> {
253 
254  template<typename PublicShares>
255  public_secret_sss(const PublicShares &public_shares) :
256  public_secret_sss(std::cbegin(public_shares), std::cend(public_shares)) {
257  }
258 
259  template<typename PublicShareIt>
260  public_secret_sss(PublicShareIt first, PublicShareIt last) :
261  public_secret(reconstruct_public_secret(first, last)) {
262  }
263 
264  template<typename PublicShares>
265  public_secret_sss(const PublicShares &public_shares, const indexes_type &indexes) :
266  public_secret_sss(std::cbegin(public_shares), std::cend(public_shares), indexes) {
267  }
268 
269  template<typename PublicShareIt>
270  public_secret_sss(PublicShareIt first, PublicShareIt last, const indexes_type &indexes) :
271  public_secret(reconstruct_public_secret(first, last, indexes)) {
272  }
273 
274  inline const value_type &get_value() const {
275  return public_secret;
276  }
277 
278  bool operator==(const public_secret_sss &other) const {
279  return this->public_secret == other.public_secret;
280  }
281 
282  bool operator<(const public_secret_sss &other) const {
283  return this->public_secret < other.public_secret;
284  }
285 
286  private:
287  template<
288  typename PublicShareIt,
289  typename std::enable_if<
290  std::is_convertible<typename std::remove_cv<typename std::remove_reference<
291  typename std::iterator_traits<PublicShareIt>::value_type>::type>::type,
293  bool>::type = true>
294  static inline public_secret_type reconstruct_public_secret(PublicShareIt first, PublicShareIt last) {
295  BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<PublicShareIt>));
296 
297  return reconstruct_public_secret(first, last, scheme_type::get_indexes(first, last));
298  }
299 
300  template<
301  typename PublicShareIt,
302  typename std::enable_if<
303  std::is_convertible<typename std::remove_cv<typename std::remove_reference<
304  typename std::iterator_traits<PublicShareIt>::value_type>::type>::type,
305  public_share_sss<scheme_type>>::value,
306  bool>::type = true>
307  static inline public_secret_type reconstruct_public_secret(PublicShareIt first, PublicShareIt last,
308  const indexes_type &indexes) {
309  BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<PublicShareIt>));
310 
311  public_secret_type public_secret = public_secret_type::zero();
312  for (auto it = first; it != last; it++) {
313  public_secret =
314  public_secret + it->get_value() * scheme_type::eval_basis_poly(indexes, it->get_index());
315  }
316 
317  return public_secret;
318  }
319 
320  public_secret_type public_secret;
321  };
322 
323  template<typename Group>
324  struct secret_sss<shamir_sss<Group>> {
329 
330  template<typename Shares>
331  secret_sss(const Shares &shares) : secret_sss(std::cbegin(shares), std::cend(shares)) {
332  }
333 
334  template<typename ShareIt>
335  secret_sss(ShareIt first, ShareIt last) : secret(reconstruct_secret(first, last)) {
336  }
337 
338  template<typename Shares>
339  secret_sss(const Shares &shares, const indexes_type &indexes) :
340  secret_sss(std::cbegin(shares), std::cend(shares), indexes) {
341  }
342 
343  template<typename ShareIt>
344  secret_sss(ShareIt first, ShareIt last, const indexes_type &indexes) :
345  secret(reconstruct_secret(first, last, indexes)) {
346  }
347 
348  inline const value_type &get_value() const {
349  return secret;
350  }
351 
352  bool operator==(const secret_sss &other) const {
353  return this->secret == other.secret;
354  }
355 
356  bool operator<(const secret_sss &other) const {
357  return this->secret < other.secret;
358  }
359 
360  template<
361  typename Scheme,
362  typename std::enable_if<
363  std::is_convertible<typename std::remove_cv<typename std::remove_reference<Scheme>::type>::type,
364  scheme_type>::value,
365  bool>::type = true>
366  operator public_secret_sss<Scheme>() const {
367  using To = public_secret_sss<Scheme>;
368 
369  return To(secret * To::public_secret_type::one());
370  }
371 
372  protected:
373  template<typename ShareIt,
374  typename std::enable_if<
375  std::is_convertible<typename std::remove_cv<typename std::remove_reference<
376  typename std::iterator_traits<ShareIt>::value_type>::type>::type,
377  share_sss<scheme_type>>::value,
378  bool>::type = true>
379  static inline secret_type reconstruct_secret(ShareIt first, ShareIt last) {
380  BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<ShareIt>));
381 
382  return reconstruct_secret(first, last, scheme_type::get_indexes(first, last));
383  }
384 
385  template<typename ShareIt,
386  typename std::enable_if<
387  std::is_convertible<typename std::remove_cv<typename std::remove_reference<
388  typename std::iterator_traits<ShareIt>::value_type>::type>::type,
389  share_sss<scheme_type>>::value,
390  bool>::type = true>
391  static inline secret_type reconstruct_secret(ShareIt first, ShareIt last, const indexes_type &indexes) {
392  BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<ShareIt>));
393 
394  secret_type secret = secret_type::zero();
395  for (auto it = first; it != last; it++) {
396  secret = secret + it->get_value() * scheme_type::eval_basis_poly(indexes, it->get_index());
397  }
398 
399  return secret;
400  }
401 
403  };
404 
405  template<typename Group>
406  struct deal_shares_op<shamir_sss<Group>> {
409  typedef std::vector<share_type> shares_type;
412 
413  protected:
414  template<typename Share, typename InternalAccumulator>
415  static inline void _init_accumulator(InternalAccumulator &acc, std::size_t n, std::size_t t) {
416  assert(scheme_type::check_threshold_value(t, n));
417 
418  std::size_t i = 1;
419  std::generate_n(std::inserter(acc, std::end(acc)), n, [&i]() { return Share(i++); });
420  }
421 
422  template<typename Scheme, typename InternalAccumulator>
423  static inline void _update(InternalAccumulator &acc, std::size_t exp,
424  const typename Scheme::coeff_type &coeff) {
425  for (auto shares_iter = std::begin(acc); shares_iter != std::end(acc); ++shares_iter) {
426  shares_iter->update(coeff, exp);
427  }
428  }
429 
430  template<typename ResultType, typename InternalAccumulator>
431  static inline ResultType _process(InternalAccumulator &acc) {
432  return acc;
433  }
434 
435  public:
436  static inline void init_accumulator(internal_accumulator_type &acc, std::size_t n, std::size_t t) {
437  _init_accumulator<share_type>(acc, n, t);
438  }
439 
440  static inline void update(internal_accumulator_type &acc, std::size_t exp,
441  const typename scheme_type::coeff_type &coeff) {
442  _update<scheme_type>(acc, exp, coeff);
443  }
444 
446  return _process<result_type>(acc);
447  }
448  };
449 
450  template<typename Group>
455  typedef std::pair<typename scheme_type::indexes_type, std::set<public_share_type>>
458 
459  protected:
460  template<typename InternalAccumulator, typename PublicShare>
461  static inline void _update(InternalAccumulator &acc, const PublicShare &public_share) {
462  bool emplace_status = acc.first.emplace(public_share.get_index()).second;
463  assert(emplace_status);
464  // acc.second.push_back(public_share);
465  emplace_status = acc.second.emplace(public_share).second;
466  assert(emplace_status);
467  }
468 
469  template<typename ResultType, typename InternalAccumulator>
470  static inline ResultType _process(InternalAccumulator &acc) {
471  return ResultType(acc.second /*, acc.first*/);
472  }
473 
474  public:
475  static inline void init_accumulator() {
476  }
477 
478  static inline void update(internal_accumulator_type &acc, const public_share_type &public_share) {
479  _update(acc, public_share);
480  }
481 
483  return _process<result_type>(acc);
484  }
485  };
486 
487  template<typename Group>
492  typedef std::pair<typename scheme_type::indexes_type, std::set<share_type>> internal_accumulator_type;
494 
495  protected:
496  template<typename InternalAccumulator, typename Share>
497  static inline void _update(InternalAccumulator &acc, const Share &share) {
498  bool emplace_status = acc.first.emplace(share.get_index()).second;
499  assert(emplace_status);
500  // acc.second.push_back(public_share);
501  emplace_status = acc.second.emplace(share).second;
502  assert(emplace_status);
503  }
504 
505  template<typename ResultType, typename InternalAccumulator>
506  static inline ResultType _process(InternalAccumulator &acc) {
507  return ResultType(acc.second /*, acc.first*/);
508  }
509 
510  public:
511  static inline void init_accumulator() {
512  }
513 
514  static inline void update(internal_accumulator_type &acc, const share_type &share) {
515  _update(acc, share);
516  }
517 
519  return _process<result_type>(acc);
520  }
521  };
522  } // namespace pubkey
523  } // namespace crypto3
524 } // namespace nil
525 
526 #endif // CRYPTO3_PUBKEY_SHAMIR_SSS_HPP
std::enable_if<!boost::accumulators::detail::is_accumulator_set< OutputIterator >::value, OutputIterator >::type reconstruct_public_secret(InputIterator first, InputIterator last, OutputIterator out)
Reconstruct public representative of secret using passed public representatives of shares.
Definition: reconstruct_public_secret.hpp:69
std::enable_if<!boost::accumulators::detail::is_accumulator_set< OutputIterator >::value, OutputIterator >::type reconstruct_secret(InputIterator first, InputIterator last, OutputIterator out)
Reconstruct secret using passed shares.
Definition: reconstruct_secret.hpp:69
boost::mpl::apply< AccumulatorSet, tag::pubkey< ProcessingMode > >::type::result_type pubkey(const AccumulatorSet &acc)
Definition: accumulators/pubkey.hpp:106
Definition: pair.hpp:31
std::vector< share_type > shares_type
Definition: shamir.hpp:409
share_sss< scheme_type > share_type
Definition: shamir.hpp:408
static result_type process(internal_accumulator_type &acc)
Definition: shamir.hpp:445
static void _update(InternalAccumulator &acc, std::size_t exp, const typename Scheme::coeff_type &coeff)
Definition: shamir.hpp:423
static void update(internal_accumulator_type &acc, std::size_t exp, const typename scheme_type::coeff_type &coeff)
Definition: shamir.hpp:440
shares_type result_type
Definition: shamir.hpp:411
static void init_accumulator(internal_accumulator_type &acc, std::size_t n, std::size_t t)
Definition: shamir.hpp:436
shares_type internal_accumulator_type
Definition: shamir.hpp:410
static void _init_accumulator(InternalAccumulator &acc, std::size_t n, std::size_t t)
Definition: shamir.hpp:415
static ResultType _process(InternalAccumulator &acc)
Definition: shamir.hpp:431
shamir_sss< Group > scheme_type
Definition: shamir.hpp:407
Definition: deal_shares_op.hpp:33
public_secret_sss(const PublicShares &public_shares)
Definition: shamir.hpp:255
public_secret_sss(PublicShareIt first, PublicShareIt last)
Definition: shamir.hpp:260
bool operator<(const public_secret_sss &other) const
Definition: shamir.hpp:282
bool operator==(const public_secret_sss &other) const
Definition: shamir.hpp:278
public_secret_type value_type
Definition: shamir.hpp:252
public_secret_sss(const PublicShares &public_shares, const indexes_type &indexes)
Definition: shamir.hpp:265
public_secret_sss(PublicShareIt first, PublicShareIt last, const indexes_type &indexes)
Definition: shamir.hpp:270
scheme_type::public_element_type public_secret_type
Definition: shamir.hpp:250
scheme_type::indexes_type indexes_type
Definition: shamir.hpp:251
shamir_sss< Group > scheme_type
Definition: shamir.hpp:249
const value_type & get_value() const
Definition: shamir.hpp:274
Definition: public_secret_sss.hpp:33
public_share_sss(std::size_t i)
Definition: shamir.hpp:142
public_share_sss(std::size_t i, const typename public_share_type::second_type &ps)
Definition: shamir.hpp:150
scheme_type::indexed_public_element_type public_share_type
Definition: shamir.hpp:135
public_share_type data_type
Definition: shamir.hpp:136
public_share_sss(const public_share_type &in_public_share)
Definition: shamir.hpp:146
public_share_type::second_type value_type
Definition: shamir.hpp:138
public_share_type public_share
Definition: shamir.hpp:176
const data_type & get_data() const
Definition: shamir.hpp:163
const value_type & get_value() const
Definition: shamir.hpp:159
shamir_sss< Group > scheme_type
Definition: shamir.hpp:134
public_share_type::first_type index_type
Definition: shamir.hpp:137
index_type get_index() const
Definition: shamir.hpp:155
bool operator<(const public_share_sss &other) const
Definition: shamir.hpp:171
bool operator==(const public_share_sss &other) const
Definition: shamir.hpp:167
Definition: public_share_sss.hpp:33
static void update(internal_accumulator_type &acc, const public_share_type &public_share)
Definition: shamir.hpp:478
static ResultType _process(InternalAccumulator &acc)
Definition: shamir.hpp:470
static result_type process(internal_accumulator_type &acc)
Definition: shamir.hpp:482
static void _update(InternalAccumulator &acc, const PublicShare &public_share)
Definition: shamir.hpp:461
public_secret_sss< scheme_type > public_secret_type
Definition: shamir.hpp:454
std::pair< typename scheme_type::indexes_type, std::set< public_share_type > > internal_accumulator_type
Definition: shamir.hpp:456
public_share_sss< scheme_type > public_share_type
Definition: shamir.hpp:453
Definition: reconstruct_public_secret_op.hpp:33
static void init_accumulator()
Definition: shamir.hpp:511
static result_type process(internal_accumulator_type &acc)
Definition: shamir.hpp:518
std::pair< typename scheme_type::indexes_type, std::set< share_type > > internal_accumulator_type
Definition: shamir.hpp:492
shamir_sss< Group > scheme_type
Definition: shamir.hpp:489
static void _update(InternalAccumulator &acc, const Share &share)
Definition: shamir.hpp:497
secret_sss< scheme_type > secret_type
Definition: shamir.hpp:491
share_sss< scheme_type > share_type
Definition: shamir.hpp:490
static ResultType _process(InternalAccumulator &acc)
Definition: shamir.hpp:506
static void update(internal_accumulator_type &acc, const share_type &share)
Definition: shamir.hpp:514
Definition: reconstruct_secret_op.hpp:33
secret_sss(ShareIt first, ShareIt last)
Definition: shamir.hpp:335
secret_type secret
Definition: shamir.hpp:402
static secret_type reconstruct_secret(ShareIt first, ShareIt last)
Definition: shamir.hpp:379
secret_type value_type
Definition: shamir.hpp:328
bool operator<(const secret_sss &other) const
Definition: shamir.hpp:356
scheme_type::indexes_type indexes_type
Definition: shamir.hpp:327
static secret_type reconstruct_secret(ShareIt first, ShareIt last, const indexes_type &indexes)
Definition: shamir.hpp:391
secret_sss(ShareIt first, ShareIt last, const indexes_type &indexes)
Definition: shamir.hpp:344
secret_sss(const Shares &shares, const indexes_type &indexes)
Definition: shamir.hpp:339
scheme_type::private_element_type secret_type
Definition: shamir.hpp:326
bool operator==(const secret_sss &other) const
Definition: shamir.hpp:352
secret_sss(const Shares &shares)
Definition: shamir.hpp:331
shamir_sss< Group > scheme_type
Definition: shamir.hpp:325
const value_type & get_value() const
Definition: shamir.hpp:348
Definition: secret_sss.hpp:33
Definition: shamir.hpp:58
std::vector< typename basic_policy::public_coeff_type > public_coeffs_type
Definition: shamir.hpp:66
static basic_policy::private_element_type eval_basis_poly(const typename basic_policy::indexes_type &indexes, std::size_t i)
Definition: shamir.hpp:69
sss_basic_policy< group_type > basic_policy
Definition: shamir.hpp:60
static public_coeffs_type get_public_coeffs(CoeffsIt first, CoeffsIt last)
Definition: shamir.hpp:120
Group group_type
Definition: shamir.hpp:59
static coeffs_type get_poly(std::size_t t)
Definition: shamir.hpp:97
static public_coeffs_type get_public_coeffs(const Coeffs &coeffs)
Definition: shamir.hpp:113
static coeffs_type get_poly(std::size_t t, std::size_t n)
Definition: shamir.hpp:88
std::vector< typename basic_policy::coeff_type > coeffs_type
Definition: shamir.hpp:65
share_sss(const share_type &in_share)
Definition: shamir.hpp:193
bool operator==(const share_sss &other) const
Definition: shamir.hpp:225
share_type::second_type value_type
Definition: shamir.hpp:185
scheme_type::indexed_private_element_type share_type
Definition: shamir.hpp:182
share_type data_type
Definition: shamir.hpp:183
index_type get_index() const
Definition: shamir.hpp:201
const data_type & get_data() const
Definition: shamir.hpp:209
share_sss(std::size_t i)
Definition: shamir.hpp:189
share_sss(std::size_t i, const typename share_type::second_type &s)
Definition: shamir.hpp:197
const value_type & get_value() const
Definition: shamir.hpp:205
shamir_sss< Group > scheme_type
Definition: shamir.hpp:181
share_type share
Definition: shamir.hpp:244
bool operator<(const share_sss &other) const
Definition: shamir.hpp:229
void update(const typename scheme_type::coeff_type &coeff, std::size_t exp)
Definition: shamir.hpp:236
share_type::first_type index_type
Definition: shamir.hpp:184
Definition: share_sss.hpp:35
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:43
std::pair< std::size_t, private_element_type > indexed_private_element_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:49
typename Group::curve_type::scalar_field_type::value_type private_element_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:47
static bool check_participant_index(std::size_t i)
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:72
std::pair< std::size_t, public_element_type > indexed_public_element_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:50
static bool check_threshold_value(std::size_t t, std::size_t n)
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:80
static bool check_minimal_size(std::size_t size)
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:62
private_element_type coeff_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:55
typename Group::value_type public_element_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:48
static public_element_type get_public_element(const private_element_type &e)
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:90
std::set< std::size_t > indexes_type
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/basic_policy.hpp:57
Definition: weighted_basic_policy.hpp:37