Original HUSH source code based on ZEC 1.0.8 . For historical purposes only!
https://hush.is
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
/** @file
|
|
*****************************************************************************
|
|
|
|
Declaration of interfaces for wNAF ("width-w Non-Adjacent Form") exponentiation routines.
|
|
|
|
*****************************************************************************
|
|
* @author This file is part of libsnark, developed by SCIPR Lab
|
|
* and contributors (see AUTHORS).
|
|
* @copyright MIT license (see LICENSE file)
|
|
*****************************************************************************/
|
|
|
|
#ifndef WNAF_HPP_
|
|
#define WNAF_HPP_
|
|
|
|
namespace libsnark {
|
|
|
|
/**
|
|
* Find the wNAF representation of the given scalar relative to the given window size.
|
|
*/
|
|
template<mp_size_t n>
|
|
std::vector<long> find_wnaf(const size_t window_size, const bigint<n> &scalar);
|
|
|
|
/**
|
|
* In additive notation, use wNAF exponentiation (with the given window size) to compute scalar * base.
|
|
*/
|
|
template<typename T, mp_size_t n>
|
|
T fixed_window_wnaf_exp(const size_t window_size, const T &base, const bigint<n> &scalar);
|
|
|
|
/**
|
|
* In additive notation, use wNAF exponentiation (with the window size determined by T) to compute scalar * base.
|
|
*/
|
|
template<typename T, mp_size_t n>
|
|
T opt_window_wnaf_exp(const T &base, const bigint<n> &scalar, const size_t scalar_bits);
|
|
|
|
} // libsnark
|
|
|
|
#include "algebra/scalar_multiplication/wnaf.tcc"
|
|
|
|
#endif // WNAF_HPP_
|
|
|