PALISADE Lattice Crypto Library
1.11.9
A lattice crypto library for software engineers by software engineers.
|
Public Member Functions | |
void | SetValue (const std::string &str) |
T | Add (const T &b) const |
const T & | AddEq (const T &b) |
T | Sub (const T &b) const |
const T & | SubEq (const T &b) |
T | Mul (const T &b) const |
const T & | MulEq (const T &b) |
T | DividedBy (const T &b) const |
const T & | DividedByEq (const T &b) |
T | MultiplyAndRound (const T &p, const T &q) const |
const T & | MultiplyAndRoundEq (const T &p, const T &q) |
T | DivideAndRound (const T &q) const |
const T & | DivideAndRoundEq (const T &q) |
T | Mod (const T &modulus) const |
const T & | ModEq (const T &modulus) |
T | ComputeMu () const |
T | Mod (const T &modulus, const T &mu) const |
const T & | ModEq (const T &modulus, const T &mu) |
T | ModAdd (const T &b, const T &modulus) const |
const T & | ModAddEq (const T &b, const T &modulus) |
T | ModAddFast (const T &b, const T &modulus) const |
const T & | ModAddFastEq (const T &b, const T &modulus) |
T | ModAdd (const T &b, const T &modulus, const T &mu) const |
const T & | ModAddEq (const T &b, const T &modulus, const T &mu) |
T | ModSub (const T &b, const T &modulus) const |
const T & | ModSubEq (const T &b, const T &modulus) |
T | ModSubFast (const T &b, const T &modulus) const |
const T & | ModSubFastEq (const T &b, const T &modulus) |
T | ModSub (const T &b, const T &modulus, const T &mu) const |
const T & | ModSubEq (const T &b, const T &modulus, const T &mu) |
T | ModMul (const T &b, const T &modulus) const |
const T & | ModMulEq (const T &b, const T &modulus) |
T | ModMul (const T &b, const T &modulus, const T &mu) const |
const T & | ModMulEq (const T &b, const T &modulus, const T &mu) |
T | ModMulFast (const T &b, const T &modulus) const |
const T & | ModMulFastEq (const T &b, const T &modulus) |
T | ModMulFast (const T &b, const T &modulus, const T &mu) const |
const T & | ModMulFastEq (const T &b, const T &modulus, const T &mu) |
T | ModMulFastConst (const T &b, const T &modulus, const T &bInv) const |
const T & | ModMulFastConstEq (const T &b, const T &modulus, const T &bInv) |
T | ModExp (const T &b, const T &modulus) const |
const T & | ModExpEq (const T &b, const T &modulus) |
T | ModInverse (const T &modulus) const |
const T & | ModInverseEq (const T &modulus) |
T | LShift (usshort shift) const |
const T & | LShiftEq (usshort shift) |
T | RShift (usshort shift) const |
const T & | RShiftEq (usshort shift) |
int | Compare (const T &a) const |
uint64_t | ConvertToInt () const |
usint | GetMSB () const |
usint | GetLengthForBase (usint base) const |
usint | GetDigitAtIndexForBase (usint index, usint base) const |
const std::string | ToString () const |
Friends | |
T | operator+ (const T &a, const T &b) |
inline operators for the addition operation. | |
const T & | operator+= (T &a, const T &b) |
T | operator- (const T &a, const T &b) |
inline operators for the subtraction operation. | |
const T & | operator-= (T &a, const T &b) |
T | operator* (const T &a, const T &b) |
inline operators for the multiplication operation. | |
const T & | operator*= (T &a, const T &b) |
T | operator/ (const T &a, const T &b) |
inline operators for the division operation. | |
const T & | operator/= (T &a, const T &b) |
T | operator% (const T &a, const T &b) |
const T & | operator%= (T &a, const T &b) |
T | operator<< (const T &a, usshort shift) |
inline operators for the left shift operations. | |
const T & | operator<<= (T &a, usshort shift) |
T | operator>> (const T &a, usshort shift) |
inline operators for the right shift operations. | |
const T & | operator>>= (T &a, usshort shift) |
bool | operator== (const T &a, const T &b) |
bool | operator!= (const T &a, const T &b) |
bool | operator> (const T &a, const T &b) |
bool | operator>= (const T &a, const T &b) |
bool | operator< (const T &a, const T &b) |
bool | operator<= (const T &a, const T &b) |
T lbcrypto::BigIntegerInterface< T >::Add | ( | const T & | b | ) | const |
Addition operation.
&b | is the value to add. |
int lbcrypto::BigIntegerInterface< T >::Compare | ( | const T & | a | ) | const |
Compares the current BigInteger to BigInteger a.
a | is the BigInteger to be compared with. |
T lbcrypto::BigIntegerInterface< T >::ComputeMu | ( | ) | const |
Precomputes a parameter mu for Barrett modular reduction.
uint64_t lbcrypto::BigIntegerInterface< T >::ConvertToInt | ( | ) | const |
Convert the value to an int.
T lbcrypto::BigIntegerInterface< T >::DivideAndRound | ( | const T & | q | ) | const |
Divide and Rounding operation. Returns [x/q] where [] is the rounding operation.
&q | is the denominator to be divided. |
const T& lbcrypto::BigIntegerInterface< T >::DivideAndRoundEq | ( | const T & | q | ) |
Divide and Rounding operation. Returns [x/q] where [] is the rounding operation. In-place variant.
&q | is the denominator to be divided. |
T lbcrypto::BigIntegerInterface< T >::DividedBy | ( | const T & | b | ) | const |
Division operation.
&b | is the value to divide by. |
const T& lbcrypto::BigIntegerInterface< T >::DividedByEq | ( | const T & | b | ) |
Division operation. In-place variant.
&b | is the value to divide by. |
usint lbcrypto::BigIntegerInterface< T >::GetDigitAtIndexForBase | ( | usint | index, |
usint | base | ||
) | const |
Get the number of digits using a specific base - support for arbitrary base may be needed. Example: for number 83, index 2 and base 4 we have:
index:0,1,2,3
83 –base 4 decomposition–> (3,0,1,1) –at index 2–> 1
The return number is 1.
index | is the location to return value from in the specific base. |
base | is the base with which to determine length in. |
usint lbcrypto::BigIntegerInterface< T >::GetLengthForBase | ( | usint | base | ) | const |
Get the number of digits using a specific base - support for arbitrary base may be needed.
base | is the base with which to determine length in. |
usint lbcrypto::BigIntegerInterface< T >::GetMSB | ( | ) | const |
Returns the MSB location of the value.
T lbcrypto::BigIntegerInterface< T >::LShift | ( | usshort | shift | ) | const |
Left shift operation.
shift | # of bits. |
const T& lbcrypto::BigIntegerInterface< T >::LShiftEq | ( | usshort | shift | ) |
Left shift operation. In-place variant.
shift | # of bits. |
T lbcrypto::BigIntegerInterface< T >::Mod | ( | const T & | modulus | ) | const |
Naive modulus operation.
&modulus | is the modulus to perform. |
T lbcrypto::BigIntegerInterface< T >::Mod | ( | const T & | modulus, |
const T & | mu | ||
) | const |
Barrett modulus operation. Implements generalized Barrett modular reduction algorithm. Uses one precomputed value of mu.
&modulus | is the modulus to perform. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModAdd | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus addition operation.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::ModAdd | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) | const |
Barrett modulus addition operation.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
const T& lbcrypto::BigIntegerInterface< T >::ModAddEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus addition operation. In-place variant.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModAddEq | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) |
Barrett modulus addition operation. In-place variant.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModAddFast | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus addition where operands are < modulus.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModAddFastEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus addition where operands are < modulus. In-place variant.
&b | is the scalar to add. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModEq | ( | const T & | modulus | ) |
Naive modulus operation. In-place variant.
&modulus | is the modulus to perform. |
const T& lbcrypto::BigIntegerInterface< T >::ModEq | ( | const T & | modulus, |
const T & | mu | ||
) |
Barrett modulus operation. In-place variant. Implements generalized Barrett modular reduction algorithm. Uses one precomputed value of mu.
&modulus | is the modulus to perform. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModExp | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus exponentiation operation.
&b | is the scalar to exponentiate at all locations. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModExpEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus exponentiation operation. In-place variant.
&b | is the scalar to exponentiate at all locations. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::ModInverse | ( | const T & | modulus | ) | const |
Modulus inverse operation.
&modulus | is the modulus to perform. |
const T& lbcrypto::BigIntegerInterface< T >::ModInverseEq | ( | const T & | modulus | ) |
Modulus inverse operation. In-place variant.
&modulus | is the modulus to perform. |
T lbcrypto::BigIntegerInterface< T >::ModMul | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus multiplication operation.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::ModMul | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) | const |
Barrett modulus multiplication.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
const T& lbcrypto::BigIntegerInterface< T >::ModMulEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus multiplication operation. In-place variant.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModMulEq | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) |
Barrett modulus multiplication. In-place variant.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModMulFast | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus multiplication that assumes the operands are < modulus.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::ModMulFast | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) | const |
Barrett modulus multiplication that assumes the operands are < modulus.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModMulFastConst | ( | const T & | b, |
const T & | modulus, | ||
const T & | bInv | ||
) | const |
NTL-optimized modular multiplication using a precomputation for the multiplicand. Assumes operands are < modulus.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&bInv | NTL precomputation for b. |
const T& lbcrypto::BigIntegerInterface< T >::ModMulFastConstEq | ( | const T & | b, |
const T & | modulus, | ||
const T & | bInv | ||
) |
NTL-optimized modular multiplication using a precomputation for the multiplicand. Assumes operands are < modulus. In-place variant.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&bInv | NTL precomputation for b. |
const T& lbcrypto::BigIntegerInterface< T >::ModMulFastEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus multiplication that assumes the operands are < modulus. In-place variant.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModMulFastEq | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) |
Barrett modulus multiplication that assumes the operands are < modulus. In-place variant.
&b | is the scalar to multiply. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModSub | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus subtraction operation.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::ModSub | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) | const |
Barrett modulus subtraction operation.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
const T& lbcrypto::BigIntegerInterface< T >::ModSubEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus subtraction operation. In-place variant.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModSubEq | ( | const T & | b, |
const T & | modulus, | ||
const T & | mu | ||
) |
Barrett modulus subtraction operation. In-place variant.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
&mu | is the Barrett value. |
T lbcrypto::BigIntegerInterface< T >::ModSubFast | ( | const T & | b, |
const T & | modulus | ||
) | const |
Modulus subtraction where operands are < modulus.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
const T& lbcrypto::BigIntegerInterface< T >::ModSubFastEq | ( | const T & | b, |
const T & | modulus | ||
) |
Modulus subtraction where operands are < modulus. In-place variant.
&b | is the scalar to subtract. |
&modulus | is the modulus to perform operations with. |
T lbcrypto::BigIntegerInterface< T >::Mul | ( | const T & | b | ) | const |
Multiplication operation.
&b | is the value to multiply with. |
const T& lbcrypto::BigIntegerInterface< T >::MulEq | ( | const T & | b | ) |
Multiplication operation. In-place variant.
&b | is the value to multiply with. |
T lbcrypto::BigIntegerInterface< T >::MultiplyAndRound | ( | const T & | p, |
const T & | q | ||
) | const |
Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation.
&p | is the numerator to be multiplied. |
&q | is the denominator to be divided. |
const T& lbcrypto::BigIntegerInterface< T >::MultiplyAndRoundEq | ( | const T & | p, |
const T & | q | ||
) |
Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation. In-place variant.
&p | is the numerator to be multiplied. |
&q | is the denominator to be divided. |
T lbcrypto::BigIntegerInterface< T >::RShift | ( | usshort | shift | ) | const |
Right shift operation.
shift | # of bits. |
const T& lbcrypto::BigIntegerInterface< T >::RShiftEq | ( | usshort | shift | ) |
Right shift operation. In-place variant.
shift | # of bits. |
void lbcrypto::BigIntegerInterface< T >::SetValue | ( | const std::string & | str | ) |
Set from a string
str | is the string representation of the value |
T lbcrypto::BigIntegerInterface< T >::Sub | ( | const T & | b | ) | const |
Subtraction operation.
&b | is the value to subtract. |
const std::string lbcrypto::BigIntegerInterface< T >::ToString | ( | ) | const |
Convert this integer into a std::string, for serialization