Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
wnaf.test.cpp File Reference
#include "wnaf.hpp"
#include "../curves/bn254/fr.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include "booth_recode.hpp"
#include <array>
#include <gtest/gtest.h>
#include <utility>

Go to the source code of this file.

Functions

 TEST (wnaf, GetWnafBitsConstLimbBoundary)
 
 TEST (booth_recode, PackedDigitMatchesReference)
 
 TEST (booth_recode, TopWindowClampsHighLimb)
 
 TEST (EndomorphismSplit, SmallScalarFastPathBoundaries)
 
 TEST (EndomorphismSplit, BoundaryAtTwoTo127UsesGeneralPath)
 
 TEST (wnaf, WnafPowerOfTwo)
 
 TEST (wnaf, WnafZero)
 
 TEST (wnaf, WnafTwoBitWindow)
 
 TEST (wnaf, WnafFixed)
 
 TEST (wnaf, WnafFixedSimpleLo)
 
 TEST (wnaf, WnafFixedSimpleHi)
 
 TEST (wnaf, WnafFixedWithEndoSplit)
 

Function Documentation

◆ TEST() [1/12]

TEST ( booth_recode  ,
PackedDigitMatchesReference   
)

Definition at line 100 of file wnaf.test.cpp.

◆ TEST() [2/12]

TEST ( booth_recode  ,
TopWindowClampsHighLimb   
)

Definition at line 122 of file wnaf.test.cpp.

◆ TEST() [3/12]

TEST ( EndomorphismSplit  ,
BoundaryAtTwoTo127UsesGeneralPath   
)

Definition at line 151 of file wnaf.test.cpp.

◆ TEST() [4/12]

TEST ( EndomorphismSplit  ,
SmallScalarFastPathBoundaries   
)

Definition at line 134 of file wnaf.test.cpp.

◆ TEST() [5/12]

TEST ( wnaf  ,
GetWnafBitsConstLimbBoundary   
)

Definition at line 79 of file wnaf.test.cpp.

◆ TEST() [6/12]

TEST ( wnaf  ,
WnafFixed   
)

Definition at line 256 of file wnaf.test.cpp.

◆ TEST() [7/12]

TEST ( wnaf  ,
WnafFixedSimpleHi   
)

Definition at line 283 of file wnaf.test.cpp.

◆ TEST() [8/12]

TEST ( wnaf  ,
WnafFixedSimpleLo   
)

Definition at line 270 of file wnaf.test.cpp.

◆ TEST() [9/12]

TEST ( wnaf  ,
WnafFixedWithEndoSplit   
)

Definition at line 296 of file wnaf.test.cpp.

◆ TEST() [10/12]

TEST ( wnaf  ,
WnafPowerOfTwo   
)

Definition at line 164 of file wnaf.test.cpp.

◆ TEST() [11/12]

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:

127

\ R = -skew + | 4^{127 - i} . q[i].

/

i=0

Definition at line 202 of file wnaf.test.cpp.

◆ TEST() [12/12]

TEST ( wnaf  ,
WnafZero   
)

Definition at line 187 of file wnaf.test.cpp.