binaryArith.h
void addTwoNumbers(CtPtrs &sum, const CtPtrs &lhs, const CtPtrs &rhs, long sizeLimit=0, std::vector< zzX > *unpackSlotEncoding=nullptr)
Adds two numbers in binary representation where each ciphertext of the input vector contains a bit.
Definition: binaryArith.cpp:644
void multTwoNumbers(CtPtrs &product, const CtPtrs &lhs, const CtPtrs &rhs, bool rhsTwosComplement=false, long sizeLimit=0, std::vector< zzX > *unpackSlotEncoding=nullptr)
Multiply two numbers in binary representation where each ciphertext of the input vector contains a bi...
Definition: binaryArith.cpp:1027
void bitwiseOr(CtPtrs &output, const CtPtrs &lhs, const CtPtrs &rhs)
Compute a bitwise OR between lhs and rhs.
Definition: binaryArith.cpp:594
void binaryCond(CtPtrs &output, const Ctxt &cond, const CtPtrs &trueValue, const CtPtrs &falseValue)
Implementation of output = cond * trueValue + (1 - cond) * falseValue.
Definition: binaryArith.cpp:510
void subtractBinary(CtPtrs &difference, const CtPtrs &lhs, const CtPtrs &rhs, std::vector< zzX > *unpackSlotEncoding=nullptr)
Subtracts rhs from lhs where lhs, rhs are in 2's complement.
Definition: binaryArith.cpp:700
void bitwiseRotate(CtPtrs &output, const CtPtrs &input, long rotamt)
Rotate input by rotamt.
Definition: binaryArith.cpp:572
void negateBinary(CtPtrs &negation, const CtPtrs &input)
Negates a number in binary 2's complement representation.
Definition: binaryArith.cpp:680
void splitBinaryNums(CtPtrs &leftSplit, CtPtrs &rightSplit, const CtPtrs &input)
Splits a single binary number into two binary numbers leftSplit and rightSplit.
Definition: binaryArith.cpp:547
void decryptBinaryNums(std::vector< long > &pNums, const CtPtrs &eNums, const SecKey &sKey, const EncryptedArray &ea, bool twosComplement=false, bool allSlots=true)
Decrypt the binary numbers that are encrypted in eNums.
Definition: binaryArith.cpp:1353
void addManyNumbers(CtPtrs &sum, CtPtrMat &numbers, long sizeLimit=0, std::vector< zzX > *unpackSlotEncoding=nullptr)
Sum an arbitrary amount of numbers in binary representation.
Definition: binaryArith.cpp:895
Definition: apiAttributes.h:21
void bitwiseXOR(CtPtrs &output, const CtPtrs &lhs, const CtPtrs &rhs)
Compute a bitwise XOR between lhs and rhs.
Definition: binaryArith.cpp:584
void bitwiseAnd(CtPtrs &output, const CtPtrs &lhs, const CtPtrs &rhs)
Compute a bitwise AND between lhs and rhs.
Definition: binaryArith.cpp:609
long fifteenOrLess4Four(const CtPtrs &out, const CtPtrs &in, long sizeLimit=4)
Add together up to fifteen {0,1} integers, producing a 4-bit counter.
Definition: binaryArith.cpp:1317
std::vector< long > longToBitVector(long num, long bitSize)
Returns a number as a vector of bits with LSB on the left.
Definition: binaryArith.cpp:493
void binaryMask(CtPtrs &binaryNums, const Ctxt &mask)
Zeroes the slots of binaryNums where the corresponding slot of mask is 0.
Definition: binaryArith.cpp:503
void leftBitwiseShift(CtPtrs &output, const CtPtrs &input, const long shamt)
Left shift input by shamt.
Definition: binaryArith.cpp:559
void concatBinaryNums(CtPtrs &output, const CtPtrs &a, const CtPtrs &b)
Concatenates two binary numbers into a single CtPtrs object. E.g. If a=10111, b=00101 then output = 1...
Definition: binaryArith.cpp:535
void bitwiseNot(CtPtrs &output, const CtPtrs &input)
Compute a bitwise NOT of input.
Definition: binaryArith.cpp:633
void packedRecrypt(const CtPtrs &a, const CtPtrs &b, std::vector< zzX > *unpackSlotEncoding)
Function for packed recryption to recrypt multiple numbers.
Definition: binaryArith.cpp:461