ComputeFHE 1.0
General-Purpose Privacy-Preserving Computation Library for TFHE
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
computefhe::Einteger Class Reference

Represents an encrypted integer. More...

#include <Einteger.h>

Inheritance diagram for computefhe::Einteger:
Inheritance graph
[legend]
Collaboration diagram for computefhe::Einteger:
Collaboration graph
[legend]

Public Member Functions

 Einteger ()
 Default constructor. Initializes an empty or zero-valued encrypted integer.
 
 Einteger (int64_t d)
 Constructs an Einteger from a plaintext int64_t.
 
 Einteger (size_t n_digits, bool is_signed)
 Constructs an Einteger with a specified number of bits and signedness.
 
 Einteger (int64_t d, size_t n_digits)
 Constructs an Einteger from a plaintext int64_t with a specified number of bits.
 
 Einteger (uint64_t d, size_t n_digits)
 Constructs an Einteger from a plaintext uint64_t with a specified number of bits.
 
 Einteger (const FixedPoint &fp, bool is_signed)
 Constructs an Einteger from an existing FixedPoint object.
 
 Einteger (const Einteger &other)
 Copy constructor.
 
virtual ~Einteger ()
 Destructor.
 
const FixedPointgetData () const
 Gets the underlying FixedPoint data.
 
size_t getSize () const
 Gets the number of bits used to represent the encrypted integer.
 
bool isSigned () const
 Checks if the encrypted integer is signed.
 
virtual const Einteger operator== (const Einteger &) const
 Encrypted equality comparison with another Einteger.
 
virtual const Einteger operator!= (const Einteger &) const
 Encrypted inequality comparison with another Einteger.
 
virtual const Einteger operator> (const Einteger &) const
 Encrypted greater-than comparison with another Einteger.
 
virtual const Einteger operator>= (const Einteger &) const
 Encrypted greater-than-or-equal comparison with another Einteger.
 
virtual const Einteger operator< (const Einteger &) const
 Encrypted less-than comparison with another Einteger.
 
virtual const Einteger operator<= (const Einteger &) const
 Encrypted less-than-or-equal comparison with another Einteger.
 
virtual const Einteger operator== (uint64_t) const
 Encrypted equality comparison with a plaintext uint64_t.
 
virtual const Einteger operator!= (uint64_t) const
 Encrypted inequality comparison with a plaintext uint64_t.
 
virtual const Einteger operator> (uint64_t) const
 Encrypted greater-than comparison with a plaintext uint64_t.
 
virtual const Einteger operator>= (uint64_t) const
 Encrypted greater-than-or-equal comparison with a plaintext uint64_t.
 
virtual const Einteger operator< (uint64_t) const
 Encrypted less-than comparison with a plaintext uint64_t.
 
virtual const Einteger operator<= (uint64_t) const
 Encrypted less-than-or-equal comparison with a plaintext uint64_t.
 
virtual const Einteger operator+ (const Einteger &) const
 Encrypted addition with another Einteger.
 
virtual const Einteger operator+= (const Einteger &)
 Encrypted addition assignment with another Einteger.
 
virtual const Einteger operator- (const Einteger &) const
 Encrypted subtraction with another Einteger.
 
virtual const Einteger operator-= (const Einteger &)
 Encrypted subtraction assignment with another Einteger.
 
virtual const Einteger operator* (const Einteger &) const
 Encrypted multiplication with another Einteger.
 
virtual const Einteger operator*= (const Einteger &)
 Encrypted multiplication assignment with another Einteger.
 
virtual const Einteger operator/ (const Einteger &) const
 Encrypted division with another Einteger.
 
virtual const Einteger operator/= (const Einteger &)
 Encrypted division assignment with another Einteger.
 
virtual const Einteger operator% (const Einteger &) const
 Encrypted modulo with another Einteger.
 
virtual const Einteger operator%= (const Einteger &)
 Encrypted modulo assignment with another Einteger.
 
virtual const Einteger operator+ (uint64_t) const
 Encrypted addition with a plaintext uint64_t.
 
virtual const Einteger operator+= (uint64_t)
 Encrypted addition assignment with a plaintext uint64_t.
 
virtual const Einteger operator- (uint64_t) const
 Encrypted subtraction with a plaintext uint64_t.
 
virtual const Einteger operator-= (uint64_t)
 Encrypted subtraction assignment with a plaintext uint64_t.
 
virtual const Einteger operator* (uint64_t) const
 Encrypted multiplication with a plaintext uint64_t.
 
virtual const Einteger operator*= (uint64_t)
 Encrypted multiplication assignment with a plaintext uint64_t.
 
virtual const Einteger operator/ (uint64_t) const
 Encrypted division with a plaintext uint64_t.
 
virtual const Einteger operator/= (uint64_t)
 Encrypted division assignment with a plaintext uint64_t.
 
virtual const Einteger operator% (uint64_t) const
 Encrypted modulo with a plaintext uint64_t.
 
virtual const Einteger operator%= (uint64_t)
 Encrypted modulo assignment with a plaintext uint64_t.
 
const Einteger operator- () const
 Encrypted unary negation (two's complement).
 
virtual const Einteger operator& (const Einteger &) const
 Encrypted bitwise AND with another Einteger.
 
virtual const Einteger operator&= (const Einteger &)
 Encrypted bitwise AND assignment with another Einteger.
 
virtual const Einteger operator| (const Einteger &) const
 Encrypted bitwise OR with another Einteger.
 
virtual const Einteger operator|= (const Einteger &)
 Encrypted bitwise OR assignment with another Einteger.
 
virtual const Einteger operator^ (const Einteger &) const
 Encrypted bitwise XOR with another Einteger.
 
virtual const Einteger operator^= (const Einteger &)
 Encrypted bitwise XOR assignment with another Einteger.
 
virtual const Einteger operator& (uint64_t) const
 Encrypted bitwise AND with a plaintext uint64_t.
 
virtual const Einteger operator&= (uint64_t)
 Encrypted bitwise AND assignment with a plaintext uint64_t.
 
virtual const Einteger operator| (uint64_t) const
 Encrypted bitwise OR with a plaintext uint64_t.
 
virtual const Einteger operator|= (uint64_t)
 Encrypted bitwise OR assignment with a plaintext uint64_t.
 
virtual const Einteger operator^ (uint64_t) const
 Encrypted bitwise XOR with a plaintext uint64_t.
 
virtual const Einteger operator^= (uint64_t)
 Encrypted bitwise XOR assignment with a plaintext uint64_t.
 
virtual const Einteger operator! () const
 Encrypted logical NOT.
 
virtual const Einteger operator~ () const
 Encrypted bitwise NOT (one's complement).
 
virtual const Einteger operator&& (const Einteger &) const
 Encrypted logical AND with another Einteger.
 
virtual const Einteger operator&& (uint64_t) const
 Encrypted logical AND with a plaintext uint64_t.
 
virtual const Einteger operator|| (const Einteger &) const
 Encrypted logical OR with another Einteger.
 
virtual const Einteger operator|| (uint64_t) const
 Encrypted logical OR with a plaintext uint64_t.
 
const Einteger operator++ ()
 Pre-increment operator. Increments the encrypted integer by one.
 
const Einteger operator++ (int)
 Post-increment operator. Increments the encrypted integer by one.
 
const Einteger operator-- ()
 Pre-decrement operator. Decrements the encrypted integer by one.
 
const Einteger operator-- (int)
 Post-decrement operator. Decrements the encrypted integer by one.
 
const Einteger operator<< (int) const
 Encrypted left shift.
 
const Einteger operator<<= (int)
 Encrypted left shift assignment.
 
const Einteger operator>> (int) const
 Encrypted right shift.
 
const Einteger operator>>= (int)
 Encrypted right shift assignment.
 
Eintegeroperator= (const Einteger &)
 Assignment operator from another Einteger.
 
Eintegeroperator= (uint64_t)
 Assignment operator from a plaintext uint64_t.
 
virtual operator bool () const
 Explicit conversion to decrypted boolean.
 
virtual operator int8_t () const
 Explicit conversion to decrypted int8_t.
 
virtual operator uint8_t () const
 Explicit conversion to decrypted uint8_t.
 
virtual operator int16_t () const
 Explicit conversion to decrypted int16_t.
 
virtual operator uint16_t () const
 Explicit conversion to decrypted uint16_t.
 
virtual operator int32_t () const
 Explicit conversion to decrypted int32_t.
 
virtual operator uint32_t () const
 Explicit conversion to decrypted uint32_t.
 
virtual operator int64_t () const
 Explicit conversion to decrypted int64_t.
 
virtual operator uint64_t () const
 Explicit conversion to decrypted uint64_t.
 
virtual operator double () const
 Explicit conversion to decrypted double.
 
template<class Archive >
void save (Archive &ar, std::uint32_t const version) const
 
template<class Archive >
void load (Archive &ar, std::uint32_t const version)
 
std::string SerializedObjectName () const override
 

Static Public Member Functions

static FixedPoint promote (const Einteger &a, size_t s)
 Promotes or truncates an Einteger to a specific bit size.
 
static uint32_t SerializedVersion ()
 

Protected Member Functions

void _sync_var ()
 
void _desync_var ()
 

Static Protected Member Functions

static int64_t sign_extend (uint64_t d, size_t n_digits)
 
static bool promote (const Einteger &a, const Einteger &b, FixedPoint &a_out, FixedPoint &b_out)
 

Protected Attributes

FixedPoint data
 
size_t size
 
bool sign
 

Static Protected Attributes

static FixedPoint cached_divident
 
static FixedPoint cached_divisor
 
static FixedPoint cached_quotient
 
static FixedPoint cached_remainder
 

Friends

ostreamoperator<< (ostream &out, const Einteger &obj)
 Overloads the stream insertion operator by decrypting Einteger.
 
const Einteger operator== (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t equality comparison with Einteger.
 
const Einteger operator!= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t inequality comparison with Einteger.
 
const Einteger operator> (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t greater-than comparison with Einteger.
 
const Einteger operator>= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t greater-than-or-equal comparison with Einteger.
 
const Einteger operator< (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t less-than comparison with Einteger.
 
const Einteger operator<= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t less-than-or-equal comparison with Einteger.
 
const Einteger operator+ (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t addition with Einteger.
 
const Einteger operator- (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t subtraction with Einteger.
 
const Einteger operator* (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t multiplication with Einteger.
 
const Einteger operator/ (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t division with Einteger.
 
const Einteger operator% (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t modulo with Einteger.
 
const Einteger operator& (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t bitwise AND with Einteger.
 
const Einteger operator| (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t bitwise OR with Einteger.
 
const Einteger operator^ (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t bitwise XOR with Einteger.
 
const Einteger operator&& (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t logical AND with Einteger.
 
const Einteger operator|| (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t logical OR with Einteger.
 

Detailed Description

Represents an encrypted integer.

This class provides a high-level interface for performing arithmetic, logical, and comparison operations on encrypted integer values.

Constructor & Destructor Documentation

◆ Einteger() [1/6]

computefhe::Einteger::Einteger ( int64_t  d)

Constructs an Einteger from a plaintext int64_t.

Parameters
dThe plaintext integer value.

◆ Einteger() [2/6]

computefhe::Einteger::Einteger ( size_t  n_digits,
bool  is_signed 
)

Constructs an Einteger with a specified number of bits and signedness.

Parameters
n_digitsThe number of bits for the integer.
is_signedTrue if the integer is signed, false otherwise.

◆ Einteger() [3/6]

computefhe::Einteger::Einteger ( int64_t  d,
size_t  n_digits 
)

Constructs an Einteger from a plaintext int64_t with a specified number of bits.

Parameters
dThe plaintext integer value.
n_digitsThe number of bits for the integer.

◆ Einteger() [4/6]

computefhe::Einteger::Einteger ( uint64_t  d,
size_t  n_digits 
)

Constructs an Einteger from a plaintext uint64_t with a specified number of bits.

Parameters
dThe plaintext unsigned integer value.
n_digitsThe number of bits for the integer.

◆ Einteger() [5/6]

computefhe::Einteger::Einteger ( const FixedPoint fp,
bool  is_signed 
)

Constructs an Einteger from an existing FixedPoint object.

Parameters
fpThe FixedPoint object representing the encrypted bits.
is_signedTrue if the integer is signed, false otherwise.

◆ Einteger() [6/6]

computefhe::Einteger::Einteger ( const Einteger other)

Copy constructor.

Parameters
otherThe Einteger object to copy from.

Member Function Documentation

◆ getData()

const FixedPoint & computefhe::Einteger::getData ( ) const

Gets the underlying FixedPoint data.

Returns
A constant reference to the FixedPoint object.

◆ getSize()

size_t computefhe::Einteger::getSize ( ) const

Gets the number of bits used to represent the encrypted integer.

Returns
The size in bits.

◆ isSigned()

bool computefhe::Einteger::isSigned ( ) const

Checks if the encrypted integer is signed.

Returns
True if signed, false otherwise.

◆ operator bool()

virtual computefhe::Einteger::operator bool ( ) const
explicitvirtual

Explicit conversion to decrypted boolean.

Returns
A decrypted boolean (1 if non-zero, 0 if zero).

◆ operator double()

virtual computefhe::Einteger::operator double ( ) const
explicitvirtual

Explicit conversion to decrypted double.

Returns
A decrypted double.

Reimplemented in computefhe::Efixedpoint.

◆ operator int16_t()

virtual computefhe::Einteger::operator int16_t ( ) const
explicitvirtual

Explicit conversion to decrypted int16_t.

Returns
A decrypted int16_t.

◆ operator int32_t()

virtual computefhe::Einteger::operator int32_t ( ) const
explicitvirtual

Explicit conversion to decrypted int32_t.

Returns
A decrypted int32_t.

◆ operator int64_t()

virtual computefhe::Einteger::operator int64_t ( ) const
explicitvirtual

Explicit conversion to decrypted int64_t.

Returns
A decrypted int64_t.

◆ operator int8_t()

virtual computefhe::Einteger::operator int8_t ( ) const
explicitvirtual

Explicit conversion to decrypted int8_t.

Returns
A decrypted int8_t.

◆ operator uint16_t()

virtual computefhe::Einteger::operator uint16_t ( ) const
explicitvirtual

Explicit conversion to decrypted uint16_t.

Returns
A decrypted uint16_t.

◆ operator uint32_t()

virtual computefhe::Einteger::operator uint32_t ( ) const
explicitvirtual

Explicit conversion to decrypted uint32_t.

Returns
A decrypted uint32_t.

◆ operator uint64_t()

virtual computefhe::Einteger::operator uint64_t ( ) const
explicitvirtual

Explicit conversion to decrypted uint64_t.

Returns
A decrypted uint64_t.

◆ operator uint8_t()

virtual computefhe::Einteger::operator uint8_t ( ) const
explicitvirtual

Explicit conversion to decrypted uint8_t.

Returns
A decrypted uint8_t.

◆ operator!()

virtual const Einteger computefhe::Einteger::operator! ( ) const
virtual

Encrypted logical NOT.

Returns
An Einteger representing the encrypted boolean result (1 if zero, 0 if non-zero).

◆ operator!=() [1/2]

Encrypted inequality comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if not equal, 0 if equal).

Reimplemented in computefhe::Efixedpoint.

◆ operator!=() [2/2]

Encrypted inequality comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator%() [1/2]

virtual const Einteger computefhe::Einteger::operator% ( const Einteger ) const
virtual

Encrypted modulo with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A new Einteger representing the remainder.

◆ operator%() [2/2]

virtual const Einteger computefhe::Einteger::operator% ( uint64_t  ) const
virtual

Encrypted modulo with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A new Einteger representing the remainder.

◆ operator%=() [1/2]

virtual const Einteger computefhe::Einteger::operator%= ( const Einteger )
virtual

Encrypted modulo assignment with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A reference to this Einteger after modulo.

◆ operator%=() [2/2]

virtual const Einteger computefhe::Einteger::operator%= ( uint64_t  )
virtual

Encrypted modulo assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A reference to this Einteger after modulo.

◆ operator&() [1/2]

virtual const Einteger computefhe::Einteger::operator& ( const Einteger ) const
virtual

Encrypted bitwise AND with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the bitwise AND.

◆ operator&() [2/2]

virtual const Einteger computefhe::Einteger::operator& ( uint64_t  ) const
virtual

Encrypted bitwise AND with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the bitwise AND.

◆ operator&&() [1/2]

virtual const Einteger computefhe::Einteger::operator&& ( const Einteger ) const
virtual

Encrypted logical AND with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator&&() [2/2]

virtual const Einteger computefhe::Einteger::operator&& ( uint64_t  ) const
virtual

Encrypted logical AND with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator&=() [1/2]

virtual const Einteger computefhe::Einteger::operator&= ( const Einteger )
virtual

Encrypted bitwise AND assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after bitwise AND.

◆ operator&=() [2/2]

virtual const Einteger computefhe::Einteger::operator&= ( uint64_t  )
virtual

Encrypted bitwise AND assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after bitwise AND.

◆ operator*() [1/2]

virtual const Einteger computefhe::Einteger::operator* ( const Einteger ) const
virtual

Encrypted multiplication with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the product.

Reimplemented in computefhe::Efixedpoint.

◆ operator*() [2/2]

virtual const Einteger computefhe::Einteger::operator* ( uint64_t  ) const
virtual

Encrypted multiplication with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the product.

Reimplemented in computefhe::Efixedpoint.

◆ operator*=() [1/2]

virtual const Einteger computefhe::Einteger::operator*= ( const Einteger )
virtual

Encrypted multiplication assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after multiplication.

Reimplemented in computefhe::Efixedpoint.

◆ operator*=() [2/2]

virtual const Einteger computefhe::Einteger::operator*= ( uint64_t  )
virtual

Encrypted multiplication assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after multiplication.

Reimplemented in computefhe::Efixedpoint.

◆ operator+() [1/2]

virtual const Einteger computefhe::Einteger::operator+ ( const Einteger ) const
virtual

Encrypted addition with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the sum.

Reimplemented in computefhe::Efixedpoint.

◆ operator+() [2/2]

virtual const Einteger computefhe::Einteger::operator+ ( uint64_t  ) const
virtual

Encrypted addition with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the sum.

Reimplemented in computefhe::Efixedpoint.

◆ operator++() [1/2]

const Einteger computefhe::Einteger::operator++ ( )

Pre-increment operator. Increments the encrypted integer by one.

Returns
A reference to this Einteger after increment.

◆ operator++() [2/2]

const Einteger computefhe::Einteger::operator++ ( int  )

Post-increment operator. Increments the encrypted integer by one.

Returns
A new Einteger representing the value before increment.

◆ operator+=() [1/2]

virtual const Einteger computefhe::Einteger::operator+= ( const Einteger )
virtual

Encrypted addition assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after addition.

Reimplemented in computefhe::Efixedpoint.

◆ operator+=() [2/2]

virtual const Einteger computefhe::Einteger::operator+= ( uint64_t  )
virtual

Encrypted addition assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after addition.

Reimplemented in computefhe::Efixedpoint.

◆ operator-() [1/3]

const Einteger computefhe::Einteger::operator- ( ) const

Encrypted unary negation (two's complement).

Returns
A new Einteger representing the negated value.

◆ operator-() [2/3]

virtual const Einteger computefhe::Einteger::operator- ( const Einteger ) const
virtual

Encrypted subtraction with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the difference.

Reimplemented in computefhe::Efixedpoint.

◆ operator-() [3/3]

virtual const Einteger computefhe::Einteger::operator- ( uint64_t  ) const
virtual

Encrypted subtraction with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the difference.

Reimplemented in computefhe::Efixedpoint.

◆ operator--() [1/2]

const Einteger computefhe::Einteger::operator-- ( )

Pre-decrement operator. Decrements the encrypted integer by one.

Returns
A reference to this Einteger after decrement.

◆ operator--() [2/2]

const Einteger computefhe::Einteger::operator-- ( int  )

Post-decrement operator. Decrements the encrypted integer by one.

Returns
A new Einteger representing the value before decrement.

◆ operator-=() [1/2]

virtual const Einteger computefhe::Einteger::operator-= ( const Einteger )
virtual

Encrypted subtraction assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after subtraction.

Reimplemented in computefhe::Efixedpoint.

◆ operator-=() [2/2]

virtual const Einteger computefhe::Einteger::operator-= ( uint64_t  )
virtual

Encrypted subtraction assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after subtraction.

Reimplemented in computefhe::Efixedpoint.

◆ operator/() [1/2]

virtual const Einteger computefhe::Einteger::operator/ ( const Einteger ) const
virtual

Encrypted division with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A new Einteger representing the quotient.

Reimplemented in computefhe::Efixedpoint.

◆ operator/() [2/2]

virtual const Einteger computefhe::Einteger::operator/ ( uint64_t  ) const
virtual

Encrypted division with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A new Einteger representing the quotient.

Reimplemented in computefhe::Efixedpoint.

◆ operator/=() [1/2]

virtual const Einteger computefhe::Einteger::operator/= ( const Einteger )
virtual

Encrypted division assignment with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A reference to this Einteger after division.

Reimplemented in computefhe::Efixedpoint.

◆ operator/=() [2/2]

virtual const Einteger computefhe::Einteger::operator/= ( uint64_t  )
virtual

Encrypted division assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A reference to this Einteger after division.

Reimplemented in computefhe::Efixedpoint.

◆ operator<() [1/2]

virtual const Einteger computefhe::Einteger::operator< ( const Einteger ) const
virtual

Encrypted less-than comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if less, 0 otherwise).

Reimplemented in computefhe::Efixedpoint.

◆ operator<() [2/2]

virtual const Einteger computefhe::Einteger::operator< ( uint64_t  ) const
virtual

Encrypted less-than comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator<<()

const Einteger computefhe::Einteger::operator<< ( int  ) const

Encrypted left shift.

Parameters
shiftThe number of positions to shift.
Returns
A new Einteger representing the shifted value.

◆ operator<<=()

const Einteger computefhe::Einteger::operator<<= ( int  )

Encrypted left shift assignment.

Parameters
shiftThe number of positions to shift.
Returns
A reference to this Einteger after shifting.

◆ operator<=() [1/2]

virtual const Einteger computefhe::Einteger::operator<= ( const Einteger ) const
virtual

Encrypted less-than-or-equal comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if less or equal, 0 otherwise).

Reimplemented in computefhe::Efixedpoint.

◆ operator<=() [2/2]

virtual const Einteger computefhe::Einteger::operator<= ( uint64_t  ) const
virtual

Encrypted less-than-or-equal comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator=() [1/2]

Einteger & computefhe::Einteger::operator= ( const Einteger )

Assignment operator from another Einteger.

Parameters
otherThe Einteger to assign from.
Returns
A reference to this Einteger.

◆ operator=() [2/2]

Einteger & computefhe::Einteger::operator= ( uint64_t  )

Assignment operator from a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer to assign.
Returns
A reference to this Einteger.

◆ operator==() [1/2]

virtual const Einteger computefhe::Einteger::operator== ( const Einteger ) const
virtual

Encrypted equality comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if equal, 0 if not).

Reimplemented in computefhe::Efixedpoint.

◆ operator==() [2/2]

virtual const Einteger computefhe::Einteger::operator== ( uint64_t  ) const
virtual

Encrypted equality comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator>() [1/2]

virtual const Einteger computefhe::Einteger::operator> ( const Einteger ) const
virtual

Encrypted greater-than comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if greater, 0 otherwise).

Reimplemented in computefhe::Efixedpoint.

◆ operator>() [2/2]

virtual const Einteger computefhe::Einteger::operator> ( uint64_t  ) const
virtual

Encrypted greater-than comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator>=() [1/2]

virtual const Einteger computefhe::Einteger::operator>= ( const Einteger ) const
virtual

Encrypted greater-than-or-equal comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if greater or equal, 0 otherwise).

Reimplemented in computefhe::Efixedpoint.

◆ operator>=() [2/2]

virtual const Einteger computefhe::Einteger::operator>= ( uint64_t  ) const
virtual

Encrypted greater-than-or-equal comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented in computefhe::Efixedpoint.

◆ operator>>()

const Einteger computefhe::Einteger::operator>> ( int  ) const

Encrypted right shift.

Parameters
shiftThe number of positions to shift.
Returns
A new Einteger representing the shifted value.

◆ operator>>=()

const Einteger computefhe::Einteger::operator>>= ( int  )

Encrypted right shift assignment.

Parameters
shiftThe number of positions to shift.
Returns
A reference to this Einteger after shifting.

◆ operator^() [1/2]

virtual const Einteger computefhe::Einteger::operator^ ( const Einteger ) const
virtual

Encrypted bitwise XOR with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the bitwise XOR.

◆ operator^() [2/2]

virtual const Einteger computefhe::Einteger::operator^ ( uint64_t  ) const
virtual

Encrypted bitwise XOR with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the bitwise XOR.

◆ operator^=() [1/2]

virtual const Einteger computefhe::Einteger::operator^= ( const Einteger )
virtual

Encrypted bitwise XOR assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after bitwise XOR.

◆ operator^=() [2/2]

virtual const Einteger computefhe::Einteger::operator^= ( uint64_t  )
virtual

Encrypted bitwise XOR assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after bitwise XOR.

◆ operator|() [1/2]

virtual const Einteger computefhe::Einteger::operator| ( const Einteger ) const
virtual

Encrypted bitwise OR with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the bitwise OR.

◆ operator|() [2/2]

virtual const Einteger computefhe::Einteger::operator| ( uint64_t  ) const
virtual

Encrypted bitwise OR with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the bitwise OR.

◆ operator|=() [1/2]

virtual const Einteger computefhe::Einteger::operator|= ( const Einteger )
virtual

Encrypted bitwise OR assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after bitwise OR.

◆ operator|=() [2/2]

virtual const Einteger computefhe::Einteger::operator|= ( uint64_t  )
virtual

Encrypted bitwise OR assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after bitwise OR.

◆ operator||() [1/2]

virtual const Einteger computefhe::Einteger::operator|| ( const Einteger ) const
virtual

Encrypted logical OR with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator||() [2/2]

virtual const Einteger computefhe::Einteger::operator|| ( uint64_t  ) const
virtual

Encrypted logical OR with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator~()

virtual const Einteger computefhe::Einteger::operator~ ( ) const
virtual

Encrypted bitwise NOT (one's complement).

Returns
A new Einteger representing the bitwise NOT.

◆ promote()

static FixedPoint computefhe::Einteger::promote ( const Einteger a,
size_t  s 
)
static

Promotes or truncates an Einteger to a specific bit size.

Parameters
aThe source integer.
sThe target bit size.
Returns
A FixedPoint representing the promoted/truncated bits.

Friends And Related Symbol Documentation

◆ operator!=

const Einteger operator!= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t inequality comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator%

const Einteger operator% ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t modulo with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the remainder.

◆ operator&

const Einteger operator& ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t bitwise AND with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the bitwise AND.

◆ operator&&

const Einteger operator&& ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t logical AND with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator*

const Einteger operator* ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t multiplication with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the product.

◆ operator+

const Einteger operator+ ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t addition with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the sum.

◆ operator-

const Einteger operator- ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t subtraction with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the difference.

◆ operator/

const Einteger operator/ ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t division with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the quotient.

◆ operator<

const Einteger operator< ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t less-than comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator<<

ostream & operator<< ( ostream out,
const Einteger obj 
)
friend

Overloads the stream insertion operator by decrypting Einteger.

Parameters
outThe output stream.
objThe Einteger object to print.
Returns
The output stream.

◆ operator<=

const Einteger operator<= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t less-than-or-equal comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator==

const Einteger operator== ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t equality comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator>

const Einteger operator> ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t greater-than comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator>=

const Einteger operator>= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t greater-than-or-equal comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator^

const Einteger operator^ ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t bitwise XOR with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the bitwise XOR.

◆ operator|

const Einteger operator| ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t bitwise OR with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the bitwise OR.

◆ operator||

const Einteger operator|| ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t logical OR with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

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