'privPointLoc'
Public Member Functions | List of all members
PrivPointUtil Class Reference

#include <PrivPointUtil.h>

Public Member Functions

std::vector< long > encodePoint (int, int, int)
 
helib::Ctxt secureLT (Encryptor &, int, int, helib::Ctxt, helib::Ptxt< helib::BGV >)
 
helib::Ctxt secureGT (Encryptor &, int, int, helib::Ctxt, helib::Ptxt< helib::BGV >)
 
helib::Ctxt secureLT (Encryptor &, int, int, helib::Ctxt, helib::Ctxt)
 
helib::Ctxt secureGT (Encryptor &, int, int, helib::Ctxt, helib::Ctxt)
 
helib::Ctxt binaryAdd (Encryptor &, int, int, helib::Ctxt, helib::Ptxt< helib::BGV >)
 
helib::Ctxt binaryMult (Encryptor &, int, int, helib::Ctxt, helib::Ptxt< helib::BGV >, int)
 
int processResult (Encryptor &, helib::Ctxt, int, int)
 

Detailed Description

Authored by Adam Caulfield (ac7717). November 3 2021.

Member Function Documentation

◆ binaryAdd()

helib::Ctxt PrivPointUtil::binaryAdd ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ptxt< helib::BGV >  b 
)

Conducts binary addition (full adder) between binary integers in a ciphertext and plaintext

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ctxt- binary value B, encoded as a plaintext vector, specifying the BGV scheme
Returns
helib::Ctxt - returns the binary value of A + B

◆ binaryMult()

helib::Ctxt PrivPointUtil::binaryMult ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ptxt< helib::BGV >  b,
int  y 
)

Conducts binary multiplier between binary integers in a ciphertext and plaintext

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ctxt- binary value B, encoded as a plaintext vector, specifying the BGV scheme
inty - multiplying the y (1) or x (0) value of the point.
Returns
helib::Ctxt - returns the binary value of A * B

◆ encodePoint()

std::vector< long > PrivPointUtil::encodePoint ( int  maxBits,
int  p,
int  nSlots 
)

Given the integer, the max number of bits, and the number of ciphertext slots, encodes the integer into a vector of binary. It is encoded such that the ith index has the ith bit.

Parameters
intvalue: the integer
intmaxBits: bit-length
intnSlots: ciphertext slots
Returns
std::vector<long>

◆ processResult()

int PrivPointUtil::processResult ( Encryptor encryptor,
helib::Ctxt  resultCtxt,
int  nSlots,
int  total 
)

Takes a ciphertext expected to contain the result. Decrypts it and converts the binary number into a decimal integer.

Parameters
Encryptor&encryptor - encryptor object
helib::Ctxt- result ciphertext
intnSlots - ciphertext slots
inttotal - total bits to print
Returns
int - returns the decimal integer of the result

◆ secureGT() [1/2]

helib::Ctxt PrivPointUtil::secureGT ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ptxt< helib::BGV >  b 
)

Conducts greater than operation between a ciphertext and a plaintext vector (for X-Node). Implements the secure comparison by Aloufi et. al.

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ptxt<helib::BGV>- binary value B, encoded as a plaintext vector, specifying the BGV scheme
Returns
helib::Ctxt - ciphertext representing A > B

◆ secureGT() [2/2]

helib::Ctxt PrivPointUtil::secureGT ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ctxt  b 
)

Conducts secure greater than operation between two ciphertexts (for Y-Node). Implements the secure comparison by Aloufi et. al.

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ctxt- binary value B, encrypted as a ciphertext
Returns
helib::Ctxt - ciphertext representing A > B

◆ secureLT() [1/2]

helib::Ctxt PrivPointUtil::secureLT ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ptxt< helib::BGV >  b 
)

Conducts secure less than or equal to operation between a ciphertext and a plaintext vector (for X-Node). Implements the secure comparison by Aloufi et. al.

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ptxt<helib::BGV>- binary value B, encoded as a plaintext vector, specifying the BGV scheme
Returns
helib::Ctxt - ciphertext representing A <= B

◆ secureLT() [2/2]

helib::Ctxt PrivPointUtil::secureLT ( Encryptor encryptor,
int  maxBits,
int  nSlots,
helib::Ctxt  a,
helib::Ctxt  b 
)

Conducts secure less than or equal to operation between two ciphertexts (for Y-Node). Implements the secure comparison by Aloufi et. al.

Parameters
Encryptor&encryptor - encryptor object
intmaxBits - bit-length
intnSlots - ciphertext slots
helib::Ctxt- binary value A, encrypted as a ciphertext
helib::Ctxt- binary value B, encrypted as a ciphertext
Returns
helib::Ctxt - ciphertext representing A <= B

The documentation for this class was generated from the following files: