34 namespace PrivateRecommendationsUtils {
41 paillierCryptoProvider(paillierCryptoProvider),
42 dgkCryptoProvider(dgkCryptoProvider),
55 BigInteger c = RandomProvider::GetInstance().GetRandomInteger(1);
81 BigInteger CiSP = RandomProvider::GetInstance().GetRandomInteger(1);
94 if (CiSP != static_cast<long>(ri.GetBit(this->GetMSBPosition()))) {
122 if (a.GetBit(0) == 0) {
132 for (
size_t i = 1; i < this->
l; ++i) {
134 BigInteger c = RandomProvider::GetInstance().GetRandomInteger(1);
163 if (a.GetBit(i) == 0) {
PaillierCiphertext Ciphertext
Provide public access to the T_Ciphertext type.
Implementation of the public-key DGK Cryptosystem.
Ciphertext GetEncryptedOne(const bool randomized=true) const
Returns [1].
Dgk::Ciphertext computeTau(const BigInteger &a, const BigInteger &tSP) const
Computes the encrypted additive share of the client.
Ciphertext GetEncryptedZero(const bool randomized=true) const
Returns [0].
Paillier::Ciphertext Compare(const BigInteger &rModTwoPowL) const
Interactive secure comparison.
virtual Ciphertext RandomizeCiphertext(const Ciphertext &ciphertext) const
Randomize encrypted number with a self-generated random value.
Definition of class DgkComparisonServer.
Paillier::Ciphertext ComputeDi(const BigInteger &rModTwoPowL) const
Computes .
Implementation of the public-key Paillier Cryptosystem.
size_t GetMSBPosition() const
Returns the bit position of the MSB of the operands (since l is not available for the dgkComparisonCl...
void SetClient(const std::shared_ptr< DgkComparisonClient > &dgkComparisonClient)
Setter for this->dgkComparisonClient.
DgkComparisonServer(const Paillier &paillierCryptoProvider, const Dgk &dgkCryptoProvider, const size_t l)
Constructor.
Definition of class DgkComparisonClient.
std::weak_ptr< const DgkComparisonClient > dgkComparisonClient
A reference to the DgkComparisonClient.
const Dgk & dgkCryptoProvider
Reference to the DGK crypto provider.
const Paillier & paillierCryptoProvider
Reference to the Paillier crypto provider.
size_t l
Bitsize of comparison operands.