]>
Commit | Line | Data |
---|---|---|
51e44864 JG |
1 | /** @file |
2 | ***************************************************************************** | |
3 | ||
4 | Declaration of interfaces for wNAF ("width-w Non-Adjacent Form") exponentiation routines. | |
5 | ||
6 | ***************************************************************************** | |
7 | * @author This file is part of libsnark, developed by SCIPR Lab | |
8 | * and contributors (see AUTHORS). | |
9 | * @copyright MIT license (see LICENSE file) | |
10 | *****************************************************************************/ | |
11 | ||
12 | #ifndef WNAF_HPP_ | |
13 | #define WNAF_HPP_ | |
14 | ||
15 | namespace libsnark { | |
16 | ||
17 | /** | |
18 | * Find the wNAF representation of the given scalar relative to the given window size. | |
19 | */ | |
20 | template<mp_size_t n> | |
21 | std::vector<long> find_wnaf(const size_t window_size, const bigint<n> &scalar); | |
22 | ||
23 | /** | |
24 | * In additive notation, use wNAF exponentiation (with the given window size) to compute scalar * base. | |
25 | */ | |
26 | template<typename T, mp_size_t n> | |
27 | T fixed_window_wnaf_exp(const size_t window_size, const T &base, const bigint<n> &scalar); | |
28 | ||
29 | /** | |
30 | * In additive notation, use wNAF exponentiation (with the window size determined by T) to compute scalar * base. | |
31 | */ | |
32 | template<typename T, mp_size_t n> | |
33 | T opt_window_wnaf_exp(const T &base, const bigint<n> &scalar, const size_t scalar_bits); | |
34 | ||
35 | } // libsnark | |
36 | ||
37 | #include "algebra/scalar_multiplication/wnaf.tcc" | |
38 | ||
39 | #endif // WNAF_HPP_ |