|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "wnaf.hpp"#include "../curves/bn254/fr.hpp"#include "barretenberg/numeric/random/engine.hpp"#include <gtest/gtest.h>Go to the source code of this file.
Functions | |
| TEST (wnaf, WnafZero) | |
| TEST (wnaf, WnafTwoBitWindow) | |
| TEST (wnaf, WnafFixed) | |
| TEST (wnaf, WnafFixedSimpleLo) | |
| TEST (wnaf, WnafFixedSimpleHi) | |
| TEST (wnaf, WnafFixedWithEndoSplit) | |
| TEST | ( | wnaf | , |
| WnafFixed | |||
| ) |
Definition at line 106 of file wnaf.test.cpp.
| TEST | ( | wnaf | , |
| WnafFixedSimpleHi | |||
| ) |
Definition at line 133 of file wnaf.test.cpp.
| TEST | ( | wnaf | , |
| WnafFixedSimpleLo | |||
| ) |
Definition at line 120 of file wnaf.test.cpp.
| TEST | ( | wnaf | , |
| WnafFixedWithEndoSplit | |||
| ) |
Definition at line 146 of file wnaf.test.cpp.
| TEST | ( | wnaf | , |
| WnafTwoBitWindow | |||
| ) |
We compute the 2-bit windowed NAF form of input.
For representing even numbers, we define a skew:
/ false if input is odd
skew = | \ true if input is even
The i-th quad value is defined as:
/ -(2b + 1) if sign = 1
q[i] = | \ (2b + 1) if sign = 0
where sign = ((wnaf[i] >> 31) == 0) and b = (wnaf[i] & 1). We can compute back the original number from the quads as:
\ R = -skew + | 4^{127 - i} . q[i].
i=0
Definition at line 52 of file wnaf.test.cpp.
| TEST | ( | wnaf | , |
| WnafZero | |||
| ) |
Definition at line 37 of file wnaf.test.cpp.