Struct tfhe::FheUint

source ·
pub struct FheUint<Id: FheUintId> { /* private fields */ }
Available on crate feature integer only.
Expand description

A Generic FHE unsigned integer

This struct is generic over some Id, as its the Id that controls how many bit they represent.

You will need to use one of this type specialization (e.g., FheUint8, FheUint12, FheUint16).

Its the type that overloads the operators (+, -, *), since the FheUint type is not Copy the operators are also overloaded to work with references.

Implementations§

source§

impl<Id: FheUintId> FheUint<Id>

source

pub fn generate_oblivious_pseudo_random( seed: Seed, random_bits_count: u64 ) -> Self

Generates an encrypted num_block blocks unsigned integer taken uniformly in [0, 2^random_bits_count[ using the given seed The encryted value is oblivious to the server It can be useful to make server random generation deterministic

use tfhe::prelude::FheDecrypt;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint8, Seed};

let config = ConfigBuilder::default().build();
let (client_key, server_key) = generate_keys(config);

set_server_key(server_key);

let random_bits_count = 3;

let ct_res = FheUint8::generate_oblivious_pseudo_random(Seed(0), random_bits_count);

let dec_result: u16 = ct_res.decrypt(&client_key);
assert!(dec_result < (1 << random_bits_count));
source§

impl<Id> FheUint<Id>
where Id: FheUintId,

source

pub fn into_raw_parts(self) -> (RadixCiphertext, Id)

source

pub fn from_raw_parts(ciphertext: RadixCiphertext, id: Id) -> Self

source

pub fn current_device(&self) -> Device

Returns the device where the ciphertext is currently on

source

pub fn move_to_device(&mut self, device: Device)

Moves (in-place) the ciphertext to the desired device.

Does nothing if the ciphertext is already in the desired device

source

pub fn try_decrypt_trivial<Clear>( &self ) -> Result<Clear, NotTrivialCiphertextError>

Tries to decrypt a trivial ciphertext

Trivial ciphertexts are ciphertexts which are not encrypted meaning they can be decrypted by any key, or even without a key.

For debugging it can be useful to use trivial ciphertext to speed up execution, and use Self::try_decrypt_trivial to decrypt temporary values and debug.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

// This is not a trivial ciphertext as we use a client key to encrypt.
let non_trivial = FheUint16::encrypt(1u16, &client_key);
// This is a trivial ciphertext
let trivial = FheUint16::encrypt_trivial(2u16);

// We can trivial decrypt
let result: Result<u16, _> = trivial.try_decrypt_trivial();
assert_eq!(result, Ok(2));

// We cannot trivial decrypt
let result: Result<u16, _> = non_trivial.try_decrypt_trivial();
matches!(result, Err(_));
source

pub fn is_trivial(&self) -> bool

Returns true if the ciphertext is a trivial encryption

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let non_trivial = FheUint16::encrypt(1u16, &client_key);
assert!(!non_trivial.is_trivial());

let trivial = FheUint16::encrypt_trivial(2u16);
assert!(trivial.is_trivial());
source

pub fn sum<'a, C>(collection: C) -> Self
where C: AsRef<[&'a Self]>,

Sums multiple ciphertexts together.

This is much more efficient than manually calling the + operator, thus using sum should always be preferred.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);
let c = FheUint16::encrypt(3u16, &client_key);

let result = FheUint16::sum([&a, &b, &c]);
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 + 2 + 3);

// Or
let result = [&a, &b, &c].into_iter().sum::<FheUint16>();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 + 2 + 3);
source

pub fn leading_zeros(&self) -> FheUint32

Returns the number of leading zeros in the binary representation of self.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0b00111111_11111111u16, &client_key);

let result = a.leading_zeros();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 2);
source

pub fn leading_ones(&self) -> FheUint32

Returns the number of leading ones in the binary representation of self.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0b11000000_00000000u16, &client_key);

let result = a.leading_ones();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 2);
source

pub fn trailing_zeros(&self) -> FheUint32

Returns the number of trailing zeros in the binary representation of self.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0b0000000_0101000u16, &client_key);

let result = a.trailing_zeros();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 3);
source

pub fn trailing_ones(&self) -> FheUint32

Returns the number of trailing ones in the binary representation of self.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0b0000000_0110111u16, &client_key);

let result = a.trailing_ones();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 3);
source

pub fn ilog2(&self) -> FheUint32

Returns the base 2 logarithm of the number, rounded down.

Result has no meaning if self encrypts 0. See Self::checked_ilog2

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(2u16, &client_key);

let result = a.ilog2();
let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 1);
source

pub fn checked_ilog2(&self) -> (FheUint32, FheBool)

Returns the base 2 logarithm of the number, rounded down.

Also returns a boolean flag that is true if the result is valid (i.e self was > 0)

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0u16, &client_key);

let (result, is_ok) = a.checked_ilog2();

let is_ok = is_ok.decrypt(&client_key);
assert_eq!(is_ok, false);

let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, 63); // result is meaningless
source§

impl<Id> FheUint<Id>
where Id: FheUintId,

source

pub fn compress(&self) -> CompressedFheUint<Id>

source§

impl<Id> FheUint<Id>
where Id: FheUintId, WopbsKey: WopbsEvaluationKey<ServerKey, RadixCiphertext>,

source

pub fn bivariate_function<F>(&self, other: &Self, func: F) -> Self
where F: Fn(u64, u64) -> u64,

Trait Implementations§

source§

impl Add<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint10) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint10) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint128) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint128) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint12) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint12) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint14) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint14) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint160) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint160) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint16Id>> for &u16

source§

fn add(self, rhs: &FheUint16) -> Self::Output

Adds a super::FheUint16 to a clear

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a + &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 + 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the + operator.
source§

impl Add<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint16) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint256) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint256) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint2) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint2) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint32) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint32) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint4) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint4) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint64) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint64) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint6) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint6) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint8) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &FheUint8) -> Self::Output

Performs the + operation. Read more
source§

impl<Id, B> Add<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn add(self, rhs: B) -> Self::Output

Adds two FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(23u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a + &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 + 3u16);
§

type Output = FheUint<Id>

The resulting type after applying the + operator.
source§

impl<Id, B> Add<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: B) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint10) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint10) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint128) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint128) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint12) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint12) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint14) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint14) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint160) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint160) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint16) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint16) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint256) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint256) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint2) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint2) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint32) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint32) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint4) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint4) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint64) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint64) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint6) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint6) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint8) -> Self::Output

Performs the + operation. Read more
source§

impl Add<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FheUint8) -> Self::Output

Performs the + operation. Read more
source§

impl<Id, I> AddAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn add_assign(&mut self, rhs: I)

Performs the += operation on FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a += &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_add(37849u16));
source§

impl BitAnd<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint10) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint10) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint128) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint128) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint12) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint12) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint14) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint14) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint160) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint160) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint16Id>> for &u16

source§

fn bitand(self, rhs: &FheUint16) -> Self::Output

Performs a bitwise ‘and’ between a clear and super::FheUint16

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a & &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 & 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the & operator.
source§

impl BitAnd<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint16) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint256) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint256) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint2) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint2) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint32) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint32) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint4) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint4) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint64) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint64) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint6) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint6) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint8) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &FheUint8) -> Self::Output

Performs the & operation. Read more
source§

impl<Id, B> BitAnd<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn bitand(self, rhs: B) -> Self::Output

Performs a bitwise ‘and’ between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

let result = &a & &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result,  3u16 & 37849u16);
§

type Output = FheUint<Id>

The resulting type after applying the & operator.
source§

impl<Id, B> BitAnd<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: B) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint10) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint10) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint128) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint128) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint12) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint12) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint14) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint14) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint160) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint160) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint16) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint16) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint256) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint256) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint2) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint2) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint32) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint32) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint4) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint4) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint64) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint64) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint6) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint6) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint8) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: FheUint8) -> Self::Output

Performs the & operation. Read more
source§

impl<Id, I> BitAndAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn bitand_assign(&mut self, rhs: I)

Performs the &= operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a &= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16 & 37849u16);
source§

impl BitOr<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint10) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint10) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint128) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint128) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint12) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint12) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint14) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint14) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint160) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint160) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint16Id>> for &u16

source§

fn bitor(self, rhs: &FheUint16) -> Self::Output

Performs a bitwise ‘or’ between a clear and super::FheUint16

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a | &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 | 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the | operator.
source§

impl BitOr<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint16) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint256) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint256) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint2) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint2) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint32) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint32) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint4) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint4) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint64) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint64) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint6) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint6) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint8) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &FheUint8) -> Self::Output

Performs the | operation. Read more
source§

impl<Id, B> BitOr<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn bitor(self, rhs: B) -> Self::Output

Performs a bitwise ‘or’ between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

let result = &a | &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result,  3u16 | 37849u16);
§

type Output = FheUint<Id>

The resulting type after applying the | operator.
source§

impl<Id, B> BitOr<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: B) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint10) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint10) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint128) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint128) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint12) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint12) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint14) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint14) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint160) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint160) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint16) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint16) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint256) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint256) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint2) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint2) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint32) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint32) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint4) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint4) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint64) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint64) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint6) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint6) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint8) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: FheUint8) -> Self::Output

Performs the | operation. Read more
source§

impl<Id, I> BitOrAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn bitor_assign(&mut self, rhs: I)

Performs the &= operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a |= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16 | 37849u16);
source§

impl BitXor<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint10) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint10) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint128) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint128) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint12) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint12) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint14) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint14) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint160) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint160) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint16Id>> for &u16

source§

fn bitxor(self, rhs: &FheUint16) -> Self::Output

Performs a bitwise ‘xor’ between a clear and super::FheUint16

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a ^ &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 ^ 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the ^ operator.
source§

impl BitXor<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint16) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint256) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint256) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint2) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint2) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint32) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint32) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint4) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint4) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint64) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint64) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint6) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint6) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint8) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &FheUint8) -> Self::Output

Performs the ^ operation. Read more
source§

impl<Id, B> BitXor<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn bitxor(self, rhs: B) -> Self::Output

Performs a bitwise ‘xor’ between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

let result = &a ^ &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result,  3u16 ^ 37849u16);
§

type Output = FheUint<Id>

The resulting type after applying the ^ operator.
source§

impl<Id, B> BitXor<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: B) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint10) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint10) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint128) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint128) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint12) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint12) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint14) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint14) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint160) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint160) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint16) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint16) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint256) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint256) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint2) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint2) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint32) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint32) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint4) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint4) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint64) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint64) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint6) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint6) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint8) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: FheUint8) -> Self::Output

Performs the ^ operation. Read more
source§

impl<Id, I> BitXorAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn bitxor_assign(&mut self, rhs: I)

Performs the ^= operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a ^= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16 ^ 37849u16);
source§

impl<Id> CastFrom<FheBool> for FheUint<Id>
where Id: FheUintId,

source§

fn cast_from(input: FheBool) -> Self

Cast a boolean ciphertext to an unsigned ciphertext

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheBool::encrypt(true, &client_key);
let b = FheUint16::cast_from(a);

let decrypted: u16 = b.decrypt(&client_key);
assert_eq!(decrypted, u16::from(true));
source§

impl<FromId, IntoId> CastFrom<FheInt<FromId>> for FheUint<IntoId>
where FromId: FheIntId, IntoId: FheUintId,

source§

fn cast_from(input: FheInt<FromId>) -> Self

Cast a FheInt to an FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt32, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheInt32::encrypt(i32::MIN, &client_key);
let b = FheUint16::cast_from(a);

let decrypted: u16 = b.decrypt(&client_key);
assert_eq!(decrypted, i32::MIN as u16);
source§

impl<FromId, IntoId> CastFrom<FheUint<FromId>> for FheInt<IntoId>
where FromId: FheUintId, IntoId: FheIntId,

source§

fn cast_from(input: FheUint<FromId>) -> Self

Cast a FheUint to a FheInt

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint32};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint32::encrypt(u32::MAX, &client_key);
let b = FheInt16::cast_from(a);

let decrypted: i16 = b.decrypt(&client_key);
assert_eq!(decrypted, u32::MAX as i16);
source§

impl<FromId, IntoId> CastFrom<FheUint<FromId>> for FheUint<IntoId>
where FromId: FheUintId, IntoId: FheUintId,

source§

fn cast_from(input: FheUint<FromId>) -> Self

Cast FheUint to another FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16, FheUint32};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint32::encrypt(u32::MAX, &client_key);
let b = FheUint16::cast_from(a);

let decrypted: u16 = b.decrypt(&client_key);
assert_eq!(decrypted, u32::MAX as u16);
source§

impl<Id: Clone + FheUintId> Clone for FheUint<Id>

source§

fn clone(&self) -> FheUint<Id>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'de, Id> Deserialize<'de> for FheUint<Id>
where Id: Deserialize<'de> + FheUintId,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<Id, B> Div<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn div(self, rhs: B) -> Self::Output

Divides two FheUint and returns the quotient

§Note

If you need both the quotient and remainder, then prefer to use FheUint::div_rem, instead of using / and % separately.

When the divisor is 0, the returned quotient will be the max value (i.e. all bits set to 1).

This behaviour should not be relied on.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a / &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16 / 3u16);
§

type Output = FheUint<Id>

The resulting type after applying the / operator.
source§

impl<Id, B> Div<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the / operator.
source§

fn div(self, rhs: B) -> Self::Output

Performs the / operation. Read more
source§

impl<Id, I> DivAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn div_assign(&mut self, rhs: I)

Performs the /= operation on FheUint

§Note

If you need both the quotient and remainder, then prefer to use FheUint::div_rem, instead of using / and % separately.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a /= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16 / 3u16);
source§

impl<Id> DivRem<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

§

type Output = (FheUint<Id>, FheUint<Id>)

source§

fn div_rem(self, rhs: &Self) -> Self::Output

source§

impl<Id> DivRem for &FheUint<Id>
where Id: FheUintId,

source§

fn div_rem(self, rhs: Self) -> Self::Output

Computes the quotient and remainder between two FheUint

If you need both the quotient and remainder, then div_rem is better than computing them separately using / and %.

§Notes

When the divisor is 0, the returned quotient will be the max value (i.e. all bits set to 1), the remainder will be the value of the numerator.

This behaviour should not be relied on.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(23u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let (quotient, remainder) = (&a).div_rem(&b);

let quotient: u16 = quotient.decrypt(&client_key);
assert_eq!(quotient, 23u16 / 3u16);
let remainder: u16 = remainder.decrypt(&client_key);
assert_eq!(remainder, 23u16 % 3u16);
§

type Output = (FheUint<Id>, FheUint<Id>)

source§

impl<Id> DivRem for FheUint<Id>
where Id: FheUintId,

§

type Output = (FheUint<Id>, FheUint<Id>)

source§

fn div_rem(self, rhs: Self) -> Self::Output

source§

impl<Id> FheBootstrap for FheUint<Id>
where Id: FheUintId, WopbsKey: WopbsEvaluationKey<ServerKey, RadixCiphertext>,

source§

fn map<F: Fn(u64) -> u64>(&self, func: F) -> Self

Compute a function over an encrypted message, and returns a new encrypted value containing the result.
source§

fn apply<F: Fn(u64) -> u64>(&mut self, func: F)

Compute a function over the encrypted message.
source§

impl<Id, ClearType> FheDecrypt<ClearType> for FheUint<Id>
where Id: FheUintId, ClearType: RecomposableFrom<u64> + UnsignedNumeric,

source§

fn decrypt(&self, key: &ClientKey) -> ClearType

Decrypts a FheUint to an unsigned type.

The unsigned type has to be explicit.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(7288u16, &client_key);

// u16 is explicit
let decrypted: u16 = a.decrypt(&client_key);
assert_eq!(decrypted, 7288u16);

// u32 is explicit
let decrypted: u32 = a.decrypt(&client_key);
assert_eq!(decrypted, 7288u32);
source§

impl<Id> FheEq<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn eq(&self, rhs: &Self) -> FheBool

Test for equality between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.eq(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 == 2u16);
source§

fn ne(&self, rhs: &Self) -> FheBool

Test for difference between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.ne(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 != 2u16);
source§

impl<Id, Clear> FheEq<Clear> for FheUint<Id>
where Clear: DecomposableInto<u64>, Id: FheUintId,

source§

fn eq(&self, rhs: Clear) -> FheBool

Test for equality between a FheUint and a clear

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.eq(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 == 2u16);
source§

fn ne(&self, rhs: Clear) -> FheBool

Test for difference between a FheUint and a clear

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.ne(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 != 2u16);
source§

impl<Id> FheEq for FheUint<Id>
where Id: FheUintId,

source§

fn eq(&self, rhs: Self) -> FheBool

source§

fn ne(&self, rhs: Self) -> FheBool

source§

impl<Id> FheKeyswitch<FheUint<Id>> for KeySwitchingKey
where Id: FheUintId,

source§

fn keyswitch(&self, input: &FheUint<Id>) -> FheUint<Id>

source§

impl<Id> FheMax<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn max(&self, rhs: &Self) -> Self::Output

Returns the max between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.max(&b);

let decrypted_max: u16 = result.decrypt(&client_key);
assert_eq!(decrypted_max, 1u16.max(2u16));
§

type Output = FheUint<Id>

source§

impl<Id, Clear> FheMax<Clear> for FheUint<Id>
where Clear: DecomposableInto<u64>, Id: FheUintId,

source§

fn max(&self, rhs: Clear) -> Self::Output

Returns the max between FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.max(b);

let decrypted_max: u16 = result.decrypt(&client_key);
assert_eq!(decrypted_max, 1u16.max(2u16));
§

type Output = FheUint<Id>

source§

impl<Id> FheMin<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn min(&self, rhs: &Self) -> Self::Output

Returns the min between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.min(&b);

let decrypted_min: u16 = result.decrypt(&client_key);
assert_eq!(decrypted_min, 1u16.min(2u16));
§

type Output = FheUint<Id>

source§

impl<Id, Clear> FheMin<Clear> for FheUint<Id>
where Id: FheUintId, Clear: DecomposableInto<u64>,

source§

fn min(&self, rhs: Clear) -> Self::Output

Returns the min between FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.min(b);

let decrypted_min: u16 = result.decrypt(&client_key);
assert_eq!(decrypted_min, 1u16.min(2u16));
§

type Output = FheUint<Id>

source§

impl<Id> FheOrd<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn lt(&self, rhs: &Self) -> FheBool

Test for less than between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.lt(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 < 2u16);
source§

fn le(&self, rhs: &Self) -> FheBool

Test for less than or equal between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.le(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 <= 2u16);
source§

fn gt(&self, rhs: &Self) -> FheBool

Test for greater than between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.gt(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 > 2u16);
source§

fn ge(&self, rhs: &Self) -> FheBool

Test for greater than or equal between two FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = FheUint16::encrypt(2u16, &client_key);

let result = a.gt(&b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 > 2u16);
source§

impl<Id, Clear> FheOrd<Clear> for FheUint<Id>
where Id: FheUintId, Clear: DecomposableInto<u64>,

source§

fn lt(&self, rhs: Clear) -> FheBool

Test for less than between a FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.lt(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 < 2u16);
source§

fn le(&self, rhs: Clear) -> FheBool

Test for less than or equal between a FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.le(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 <= 2u16);
source§

fn gt(&self, rhs: Clear) -> FheBool

Test for greater than between a FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.gt(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 > 2u16);
source§

fn ge(&self, rhs: Clear) -> FheBool

Test for greater than or equal between a FheUint and a clear value

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(1u16, &client_key);
let b = 2u16;

let result = a.ge(b);

let decrypted = result.decrypt(&client_key);
assert_eq!(decrypted, 1u16 >= 2u16);
source§

impl<Id> FheOrd for FheUint<Id>
where Id: FheUintId,

source§

fn lt(&self, rhs: Self) -> FheBool

source§

fn le(&self, rhs: Self) -> FheBool

source§

fn gt(&self, rhs: Self) -> FheBool

source§

fn ge(&self, rhs: Self) -> FheBool

source§

impl<Id, T> FheTrivialEncrypt<T> for FheUint<Id>
where T: DecomposableInto<u64> + UnsignedNumeric, Id: FheUintId,

source§

fn encrypt_trivial(value: T) -> Self

Creates a trivially encrypted FheUint

A trivial encryption is not an encryption, the value can be retrieved by anyone as if it were a clear value.

Thus no client or public key is needed to create a trivial encryption, this can be useful to initialize some values.

As soon as a trivial encryption is used in an operation that involves non trivial encryption, the result will be non trivial (secure).

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt_trivial(7288u16);

let decrypted: u16 = a.decrypt(&client_key);
assert_eq!(decrypted, 7288u16);
source§

impl<Id, T> FheTryEncrypt<T, ClientKey> for FheUint<Id>
where Id: FheUintId, T: DecomposableInto<u64> + UnsignedNumeric,

§

type Error = Error

source§

fn try_encrypt(value: T, key: &ClientKey) -> Result<Self, Self::Error>

source§

impl<Id, T> FheTryEncrypt<T, CompactPublicKey> for FheUint<Id>
where Id: FheUintId, T: DecomposableInto<u64> + UnsignedNumeric,

§

type Error = Error

source§

fn try_encrypt(value: T, key: &CompactPublicKey) -> Result<Self, Self::Error>

source§

impl<Id, T> FheTryEncrypt<T, CompressedPublicKey> for FheUint<Id>
where Id: FheUintId, T: DecomposableInto<u64> + UnsignedNumeric,

§

type Error = Error

source§

fn try_encrypt(value: T, key: &CompressedPublicKey) -> Result<Self, Self::Error>

source§

impl<Id, T> FheTryEncrypt<T, PublicKey> for FheUint<Id>
where Id: FheUintId, T: DecomposableInto<u64> + UnsignedNumeric,

§

type Error = Error

source§

fn try_encrypt(value: T, key: &PublicKey) -> Result<Self, Self::Error>

source§

impl<Id, T> FheTryTrivialEncrypt<T> for FheUint<Id>
where T: DecomposableInto<u64> + UnsignedNumeric, Id: FheUintId,

§

type Error = Error

source§

fn try_encrypt_trivial(value: T) -> Result<Self, Self::Error>

source§

impl<Id> IfThenElse<FheUint<Id>> for FheBool
where Id: FheUintId,

source§

fn if_then_else( &self, ct_then: &FheUint<Id>, ct_else: &FheUint<Id> ) -> FheUint<Id>

Conditional selection.

The output value returned depends on the value of self.

  • if self is true, the output will have the value of ct_then
  • if self is false, the output will have the value of ct_else
source§

fn cmux(&self, ct_then: &Ciphertext, ct_else: &Ciphertext) -> Ciphertext

source§

impl Mul<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint10) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint10) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint128) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint128) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint12) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint12) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint14) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint14) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint160) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint160) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint16Id>> for &u16

source§

fn mul(self, rhs: &FheUint16) -> Self::Output

Multiplies a super::FheUint16 to a clear

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a * &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 * 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the * operator.
source§

impl Mul<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint16) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint256) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint256) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint6) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint6) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint8) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &FheUint8) -> Self::Output

Performs the * operation. Read more
source§

impl<Id, B> Mul<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn mul(self, rhs: B) -> Self::Output

Multiplies two FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

let result = &a * &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_mul(37849u16));
§

type Output = FheUint<Id>

The resulting type after applying the * operator.
source§

impl<Id, B> Mul<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: B) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint10) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint10) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint128) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint128) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint12) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint12) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint14) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint14) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint160) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint160) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint16) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint16) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint256) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint256) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint4) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint6) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint6) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint8) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FheUint8) -> Self::Output

Performs the * operation. Read more
source§

impl<Id, I> MulAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn mul_assign(&mut self, rhs: I)

Performs the *= operation on FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a *= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_mul(37849u16));
source§

impl<Id: FheUintId> Named for FheUint<Id>

source§

const NAME: &'static str = "high_level_api::FheUint"

source§

impl<Id> Neg for &FheUint<Id>
where Id: FheUintId,

source§

fn neg(self) -> Self::Output

Computes the negation of a FheUint.

Since FheUint are unsigned integers meaning the value they can represent is always positive, negating a FheUint will yield a positive number.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);

let result = -&a;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_neg());
§

type Output = FheUint<Id>

The resulting type after applying the - operator.
source§

impl<Id> Neg for FheUint<Id>
where Id: FheUintId,

source§

fn neg(self) -> Self::Output

Computes the negation of a FheUint.

Since FheUint are unsigned integers meaning the value they can represent is always positive, negating a FheUint will yield a positive number.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);

let result = -a;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_neg());
§

type Output = FheUint<Id>

The resulting type after applying the - operator.
source§

impl<Id> Not for &FheUint<Id>
where Id: FheUintId,

source§

fn not(self) -> Self::Output

Performs a bitwise ‘not’

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);

let result = !&a;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, !3u16);
§

type Output = FheUint<Id>

The resulting type after applying the ! operator.
source§

impl<Id> Not for FheUint<Id>
where Id: FheUintId,

source§

fn not(self) -> Self::Output

Performs a bitwise ‘not’

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);

let result = !a;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, !3u16);
§

type Output = FheUint<Id>

The resulting type after applying the ! operator.
source§

impl<Id> OverflowingAdd<&FheUint<Id>> for &FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_add(self, other: Self) -> (Self::Output, FheBool)

Adds two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(u16::MAX, &client_key);
let b = FheUint16::encrypt(1u16, &client_key);

let (result, overflowed) = (&a).overflowing_add(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, u16::MAX.wrapping_add(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    u16::MAX.overflowing_add(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id> OverflowingAdd<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_add(self, other: &Self) -> (Self::Output, FheBool)

Adds two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(u16::MAX, &client_key);
let b = FheUint16::encrypt(1u16, &client_key);

let (result, overflowed) = a.overflowing_add(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, u16::MAX.wrapping_add(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    u16::MAX.overflowing_add(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id, Clear> OverflowingAdd<Clear> for &FheUint<Id>
where Id: FheUintId, Clear: UnsignedNumeric + DecomposableInto<u8>,

source§

fn overflowing_add(self, other: Clear) -> (Self::Output, FheBool)

Adds a FheUint with a Clear and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(u16::MAX, &client_key);

let (result, overflowed) = (&a).overflowing_add(1u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, u16::MAX.wrapping_add(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    u16::MAX.overflowing_add(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id, Clear> OverflowingAdd<Clear> for FheUint<Id>
where Id: FheUintId, Clear: UnsignedNumeric + DecomposableInto<u8>,

source§

fn overflowing_add(self, other: Clear) -> (Self::Output, FheBool)

Adds a FheUint with a Clear and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(u16::MAX, &client_key);

let (result, overflowed) = a.overflowing_add(1u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, u16::MAX.wrapping_add(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    u16::MAX.overflowing_add(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id> OverflowingMul<&FheUint<Id>> for &FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_mul(self, other: Self) -> (Self::Output, FheBool)

Multiplies two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3434u16, &client_key);
let b = FheUint16::encrypt(54u16, &client_key);

let (result, overflowed) = (&a).overflowing_mul(&b);
let (expected_result, expected_overflowed) = 3434u16.overflowing_mul(54u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, expected_result);
assert_eq!(overflowed.decrypt(&client_key), expected_overflowed);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id> OverflowingMul<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_mul(self, other: &Self) -> (Self::Output, FheBool)

Multiplies two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3434u16, &client_key);
let b = FheUint16::encrypt(54u16, &client_key);

let (result, overflowed) = a.overflowing_mul(&b);
let (expected_result, expected_overflowed) = 3434u16.overflowing_mul(54u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, expected_result);
assert_eq!(overflowed.decrypt(&client_key), expected_overflowed);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id> OverflowingSub<&FheUint<Id>> for &FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_sub(self, other: Self) -> (Self::Output, FheBool)

Subtracts two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0u16, &client_key);
let b = FheUint16::encrypt(1u16, &client_key);

let (result, overflowed) = (&a).overflowing_sub(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 0u16.wrapping_sub(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    0u16.overflowing_sub(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id> OverflowingSub<&FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn overflowing_sub(self, other: &Self) -> (Self::Output, FheBool)

Subtracts two FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0u16, &client_key);
let b = FheUint16::encrypt(1u16, &client_key);

let (result, overflowed) = a.overflowing_sub(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 0u16.wrapping_sub(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    0u16.overflowing_sub(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id, Clear> OverflowingSub<Clear> for &FheUint<Id>
where Id: FheUintId, Clear: UnsignedNumeric + DecomposableInto<u8>,

source§

fn overflowing_sub(self, other: Clear) -> (Self::Output, FheBool)

Subtracts a FheUint with a Clear and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0u16, &client_key);

let (result, overflowed) = (&a).overflowing_sub(1u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 0u16.wrapping_sub(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    0u16.overflowing_sub(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id, Clear> OverflowingSub<Clear> for FheUint<Id>
where Id: FheUintId, Clear: UnsignedNumeric + DecomposableInto<u8>,

source§

fn overflowing_sub(self, other: Clear) -> (Self::Output, FheBool)

Subtracts a FheUint with a Clear and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(0u16, &client_key);

let (result, overflowed) = a.overflowing_sub(1u16);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 0u16.wrapping_sub(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    0u16.overflowing_sub(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

source§

impl<Id: FheUintId> ParameterSetConformant for FheUint<Id>

§

type ParameterSet = FheUintConformanceParams<Id>

source§

fn is_conformant(&self, params: &FheUintConformanceParams<Id>) -> bool

source§

impl<Id, B> Rem<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn rem(self, rhs: B) -> Self::Output

Divides two FheUint and returns the remainder

§Note

If you need both the quotient and remainder, then prefer to use FheUint::div_rem, instead of using / and % separately.

When the divisor is 0, the returned remainder will have the value of the numerator.

This behaviour should not be relied on.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a % &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16 % 3u16);
§

type Output = FheUint<Id>

The resulting type after applying the % operator.
source§

impl<Id, B> Rem<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: B) -> Self::Output

Performs the % operation. Read more
source§

impl<Id, I> RemAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn rem_assign(&mut self, rhs: I)

Performs the %= operation on FheUint

§Note

If you need both the quotient and remainder, then prefer to use FheUint::div_rem, instead of using / and % separately.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a %= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16 % 3u16);
source§

impl<Id, Id2> RotateLeft<&FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_left(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise left rotation of a FheInt by a FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = (&a).rotate_left(&b);
let result: i16 = result.decrypt(&client_key);
assert_eq!(result, 7849i16.rotate_left(3));
§

type Output = FheInt<Id>

source§

impl<Id, Id2> RotateLeft<&FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_left(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise left rotation of a FheUint by another FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = (&a).rotate_left(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16.rotate_left(3));
§

type Output = FheUint<Id>

source§

impl<Id, Id2> RotateLeft<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_left(self, rhs: &FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeft<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_left(self, rhs: &FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeft<FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_left(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeft<FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_left(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeft<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_left(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeft<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_left(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateLeftAssign<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_left_assign(&mut self, rhs: &FheUint<Id2>)

Performs a left bit rotation and assign operation on FheInt

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a.rotate_left_assign(&b);
let result: i16 = a.decrypt(&client_key);
assert_eq!(result, 7849i16.rotate_left(3));
source§

impl<Id, Id2> RotateLeftAssign<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_left_assign(&mut self, rhs: &FheUint<Id2>)

Performs a left bit rotation and assign operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a.rotate_left_assign(&b);
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16.rotate_left(3));
source§

impl<Id, Id2> RotateLeftAssign<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_left_assign(&mut self, rhs: FheUint<Id2>)

source§

impl<Id, Id2> RotateLeftAssign<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_left_assign(&mut self, rhs: FheUint<Id2>)

source§

impl<Id, Id2> RotateRight<&FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_right(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise right rotation of a FheInt by a FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = (&a).rotate_right(&b);
let result: i16 = result.decrypt(&client_key);
assert_eq!(result, 7849i16.rotate_right(3));
§

type Output = FheInt<Id>

source§

impl<Id, Id2> RotateRight<&FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_right(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise right rotation of a FheUint by another FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = (&a).rotate_right(&b);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16.rotate_right(3));
§

type Output = FheUint<Id>

source§

impl<Id, Id2> RotateRight<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_right(self, rhs: &FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRight<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_right(self, rhs: &FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRight<FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_right(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRight<FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_right(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRight<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

source§

fn rotate_right(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRight<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

source§

fn rotate_right(self, rhs: FheUint<Id2>) -> Self::Output

source§

impl<Id, Id2> RotateRightAssign<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_right_assign(&mut self, rhs: &FheUint<Id2>)

Performs a right bit rotation and assign operation on FheInt

§Note
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a.rotate_right_assign(&b);
let result: i16 = a.decrypt(&client_key);
assert_eq!(result, 7849i16.rotate_right(3));
source§

impl<Id, Id2> RotateRightAssign<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_right_assign(&mut self, rhs: &FheUint<Id2>)

Performs a right bit rotation and assign operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a.rotate_right_assign(&b);
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16.rotate_right(3));
source§

impl<Id, Id2> RotateRightAssign<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn rotate_right_assign(&mut self, rhs: FheUint<Id2>)

source§

impl<Id, Id2> RotateRightAssign<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn rotate_right_assign(&mut self, rhs: FheUint<Id2>)

source§

impl<Id> Serialize for FheUint<Id>
where Id: Serialize + FheUintId,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Id, Id2> Shl<&FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shl(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise left shift of a FheInt by a FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a << &b;
let result: i16 = result.decrypt(&client_key);
assert_eq!(result, 7849i16 << 3u16);
§

type Output = FheInt<Id>

The resulting type after applying the << operator.
source§

impl<Id, Id2> Shl<&FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shl(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise left shift of a FheUint by another FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a << &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16 << 3u16);
§

type Output = FheUint<Id>

The resulting type after applying the << operator.
source§

impl<Id, Id2> Shl<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> Shl<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> Shl<FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> Shl<FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> Shl<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> Shl<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: FheUint<Id2>) -> Self::Output

Performs the << operation. Read more
source§

impl<Id, Id2> ShlAssign<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shl_assign(&mut self, rhs: &FheUint<Id2>)

Performs the <<= operation on FheInt

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a <<= &b;
let result: i16 = a.decrypt(&client_key);
assert_eq!(result, 7849i16 << 3u16);
source§

impl<Id, Id2> ShlAssign<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shl_assign(&mut self, rhs: &FheUint<Id2>)

Performs the <<= operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a <<= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16 << 3u16);
source§

impl<Id, Id2> ShlAssign<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shl_assign(&mut self, rhs: FheUint<Id2>)

Performs the <<= operation. Read more
source§

impl<Id, Id2> ShlAssign<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shl_assign(&mut self, rhs: FheUint<Id2>)

Performs the <<= operation. Read more
source§

impl<Id, Id2> Shr<&FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shr(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise right shift of a FheInt by a FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a >> &b;
let result: i16 = result.decrypt(&client_key);
assert_eq!(result, 7849i16 >> 3u16);
§

type Output = FheInt<Id>

The resulting type after applying the >> operator.
source§

impl<Id, Id2> Shr<&FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shr(self, rhs: &FheUint<Id2>) -> Self::Output

Performs a bitwise right shift of a FheUint by another FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

let result = &a >> &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 37849u16 >> 3u16);
§

type Output = FheUint<Id>

The resulting type after applying the >> operator.
source§

impl<Id, Id2> Shr<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> Shr<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> Shr<FheUint<Id2>> for &FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> Shr<FheUint<Id2>> for &FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> Shr<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

§

type Output = FheInt<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> Shr<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

§

type Output = FheUint<Id>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: FheUint<Id2>) -> Self::Output

Performs the >> operation. Read more
source§

impl<Id, Id2> ShrAssign<&FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shr_assign(&mut self, rhs: &FheUint<Id2>)

Performs the >>= operation on FheInt

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheInt16::encrypt(7849i16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a >>= &b;
let result: i16 = a.decrypt(&client_key);
assert_eq!(result, 7849i16 >> 3u16);
source§

impl<Id, Id2> ShrAssign<&FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shr_assign(&mut self, rhs: &FheUint<Id2>)

Performs the >>= operation on FheUint

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(37849u16, &client_key);
let b = FheUint16::encrypt(3u16, &client_key);

a >>= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 37849u16 >> 3u16);
source§

impl<Id, Id2> ShrAssign<FheUint<Id2>> for FheInt<Id>
where Id: FheIntId, Id2: FheUintId,

source§

fn shr_assign(&mut self, rhs: FheUint<Id2>)

Performs the >>= operation. Read more
source§

impl<Id, Id2> ShrAssign<FheUint<Id2>> for FheUint<Id>
where Id: FheUintId, Id2: FheUintId,

source§

fn shr_assign(&mut self, rhs: FheUint<Id2>)

Performs the >>= operation. Read more
source§

impl Sub<&FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint10) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint10) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint128) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint128) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint12) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint12) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint14) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint14) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint160) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint160) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint16Id>> for &u16

source§

fn sub(self, rhs: &FheUint16) -> Self::Output

Subtract a super::FheUint16 to a clear

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = 23u16;
let b = FheUint16::encrypt(3u16, &client_key);

let result = a - &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 23u16 - 3u16);
§

type Output = FheUint<FheUint16Id>

The resulting type after applying the - operator.
source§

impl Sub<&FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint16) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint256) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint256) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint2) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint2) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint4) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint4) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint64) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint64) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint6) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint6) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint8) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<&FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &FheUint8) -> Self::Output

Performs the - operation. Read more
source§

impl<Id, B> Sub<B> for &FheUint<Id>
where Id: FheUintId, B: Borrow<FheUint<Id>>,

source§

fn sub(self, rhs: B) -> Self::Output

Subtracts two FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

let result = &a - &b;
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_sub(37849u16));
§

type Output = FheUint<Id>

The resulting type after applying the - operator.
source§

impl<Id, B> Sub<B> for FheUint<Id>
where Id: FheUintId, B: Borrow<Self>,

§

type Output = FheUint<Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: B) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint10Id>> for &u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint10) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint10Id>> for u16

§

type Output = FheUint<FheUint10Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint10) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint128Id>> for &u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint128) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint128Id>> for u128

§

type Output = FheUint<FheUint128Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint128) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint12Id>> for &u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint12) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint12Id>> for u16

§

type Output = FheUint<FheUint12Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint12) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint14Id>> for &u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint14) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint14Id>> for u16

§

type Output = FheUint<FheUint14Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint14) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint160Id>> for &U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint160) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint160Id>> for U256

§

type Output = FheUint<FheUint160Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint160) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint16Id>> for &u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint16) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint16Id>> for u16

§

type Output = FheUint<FheUint16Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint16) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint256Id>> for &U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint256) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint256Id>> for U256

§

type Output = FheUint<FheUint256Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint256) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint2Id>> for &u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint2) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint2Id>> for u8

§

type Output = FheUint<FheUint2Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint2) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint32Id>> for &u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint32Id>> for u32

§

type Output = FheUint<FheUint32Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint4Id>> for &u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint4) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint4Id>> for u8

§

type Output = FheUint<FheUint4Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint4) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint64Id>> for &u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint64) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint64Id>> for u64

§

type Output = FheUint<FheUint64Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint64) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint6Id>> for &u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint6) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint6Id>> for u8

§

type Output = FheUint<FheUint6Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint6) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint8Id>> for &u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint8) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<FheUint<FheUint8Id>> for u8

§

type Output = FheUint<FheUint8Id>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FheUint8) -> Self::Output

Performs the - operation. Read more
source§

impl<Id, I> SubAssign<I> for FheUint<Id>
where Id: FheUintId, I: Borrow<Self>,

source§

fn sub_assign(&mut self, rhs: I)

Performs the -= operation on FheUint

The operation is modular, i.e on overflow it wraps around.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let mut a = FheUint16::encrypt(3u16, &client_key);
let b = FheUint16::encrypt(37849u16, &client_key);

a -= &b;
let result: u16 = a.decrypt(&client_key);
assert_eq!(result, 3u16.wrapping_sub(37849u16));
source§

impl<'a, Id> Sum<&'a FheUint<Id>> for FheUint<Id>
where Id: FheUintId,

source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Sums multiple ciphertexts together.

This is much more efficient than manually calling the + operator, thus using sum should always be preferred.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let clears = [1, 2, 3, 4, 5];
let encrypted = clears
    .iter()
    .copied()
    .map(|x| FheUint16::encrypt(x, &client_key))
    .collect::<Vec<_>>();

// Iter and sum on references
let result = encrypted.iter().sum::<FheUint16>();

let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, clears.into_iter().sum::<u16>());
source§

impl<Id> Sum for FheUint<Id>
where Id: FheUintId,

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Sums multiple ciphertexts together.

This is much more efficient than manually calling the + operator, thus using sum should always be preferred.

§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let clears = [1, 2, 3, 4, 5];
let encrypted = clears
    .iter()
    .copied()
    .map(|x| FheUint16::encrypt(x, &client_key))
    .collect::<Vec<_>>();

// Iter and sum consuming (moving out) from the original Vec
let result = encrypted.into_iter().sum::<FheUint16>();

let decrypted: u16 = result.decrypt(&client_key);
assert_eq!(decrypted, clears.into_iter().sum::<u16>());
source§

impl<Id> TryFrom<BaseRadixCiphertext<Ciphertext>> for FheUint<Id>
where Id: FheUintId,

§

type Error = GenericIntegerBlockError

The type returned in the event of a conversion error.
source§

fn try_from(other: RadixCiphertext) -> Result<Self, GenericIntegerBlockError>

Performs the conversion.
source§

impl<Id, T> TryFrom<Vec<T>> for FheUint<Id>
where Id: FheUintId, RadixCiphertext: From<Vec<T>>,

§

type Error = GenericIntegerBlockError

The type returned in the event of a conversion error.
source§

fn try_from(blocks: Vec<T>) -> Result<Self, GenericIntegerBlockError>

Performs the conversion.

Auto Trait Implementations§

§

impl<Id> Freeze for FheUint<Id>
where Id: Freeze,

§

impl<Id> RefUnwindSafe for FheUint<Id>
where Id: RefUnwindSafe,

§

impl<Id> Send for FheUint<Id>
where Id: Send,

§

impl<Id> Sync for FheUint<Id>
where Id: Sync,

§

impl<Id> Unpin for FheUint<Id>
where Id: Unpin,

§

impl<Id> UnwindSafe for FheUint<Id>
where Id: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Input, Output> CastInto<Output> for Input
where Output: CastFrom<Input>,

source§

fn cast_into(self) -> Output

source§

impl<Clear, Key, T> FheEncrypt<Clear, Key> for T
where T: FheTryEncrypt<Clear, Key>,

source§

fn encrypt(value: Clear, key: &Key) -> T

Available on crate feature integer only.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Id, Clear> OverflowingAdd<&FheUint<Id>> for Clear
where Id: FheUintId, Clear: UnsignedNumeric + DecomposableInto<u8>,

source§

fn overflowing_add( self, other: &FheUint<Id> ) -> (<Clear as OverflowingAdd<&FheUint<Id>>>::Output, FheBool)

Available on crate feature integer only.

Adds a Clear with a FheUint and returns a boolean indicating overflow.

  • The operation is modular, i.e on overflow the result wraps around.
  • On overflow the FheBool is true, otherwise false
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16};

let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);

let a = FheUint16::encrypt(u16::MAX, &client_key);

// Due to conflicts with u16::overflowing_add method
// we have to use this syntax to help the compiler
let (result, overflowed) = OverflowingAdd::overflowing_add(1u16, &a);
let result: u16 = result.decrypt(&client_key);
assert_eq!(result, u16::MAX.wrapping_add(1u16));
assert_eq!(
    overflowed.decrypt(&client_key),
    u16::MAX.overflowing_add(1u16).1
);
assert_eq!(overflowed.decrypt(&client_key), true);
§

type Output = FheUint<Id>

Available on crate feature integer only.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,