Struct concrete::GenericInteger
source · [−]pub struct GenericInteger<P: IntegerParameter> { /* private fields */ }
integers
only.Expand description
A Generic FHE unsigned integer
Contrary to shortints, these integers can in theory by parametrized to represent integers of any number of bits (eg: 16, 24, 32, 64).
However, in practice going above 16 bits may not be ideal as the computations would not scale and become very expensive.
Integers works by combining together multiple shortints with one of the available representation.
This struct is generic over some parameters, as its the parameters 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 GenericInteger
type is not Copy
the operators are also overloaded
to work with references.
To be able to use this type, the cargo feature integers
must be enabled,
and your config should also enable the type with either default parameters or custom ones.
Implementations
sourceimpl<P> GenericInteger<P>where
P: StaticIntegerParameter,
impl<P> GenericInteger<P>where
P: StaticIntegerParameter,
sourceimpl<P> GenericInteger<P>where
P: StaticIntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: WopbsExecutor<P, <P as StaticIntegerParameter>::Representation>,
impl<P> GenericInteger<P>where
P: StaticIntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: WopbsExecutor<P, <P as StaticIntegerParameter>::Representation>,
Trait Implementations
sourceimpl<P, B> Add<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Add<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> Add<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Add<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the +
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a + b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) + Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a + &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) + Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P> Add<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Add<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Add<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAdd<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P, I> AddAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> AddAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn add_assign(&mut self, rhs: I)
fn add_assign(&mut self, rhs: I)
+=
operation. Read moresourceimpl<P> AddAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
impl<P> AddAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
sourcefn add_assign(&mut self, rhs: u16)
fn add_assign(&mut self, rhs: u16)
+=
operation. Read moresourceimpl<P> AddAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
impl<P> AddAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
sourcefn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
+=
operation. Read moresourceimpl<P> AddAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
impl<P> AddAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
sourcefn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+=
operation. Read moresourceimpl<P> AddAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
impl<P> AddAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartAddAssign<P::InnerCiphertext, u64>,
sourcefn add_assign(&mut self, rhs: u8)
fn add_assign(&mut self, rhs: u8)
+=
operation. Read moresourceimpl<P, B> BitAnd<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAnd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitAnd<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAnd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> BitAnd<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAnd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitAnd<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAnd<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the &
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a & b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) & Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a & &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) & Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P, I> BitAndAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAndAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> BitAndAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitAndAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn bitand_assign(&mut self, rhs: I)
fn bitand_assign(&mut self, rhs: I)
&=
operation. Read moresourceimpl<P, B> BitOr<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOr<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitOr<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOr<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> BitOr<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOr<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitOr<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOr<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the |
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a | b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) | Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a | &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) | Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P, I> BitOrAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOrAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> BitOrAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitOrAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn bitor_assign(&mut self, rhs: I)
fn bitor_assign(&mut self, rhs: I)
|=
operation. Read moresourceimpl<P, B> BitXor<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXor<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitXor<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXor<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> BitXor<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXor<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> BitXor<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXor<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the ^
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a ^ b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) ^ Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a ^ &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) ^ Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P, I> BitXorAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXorAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> BitXorAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartBitXorAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn bitxor_assign(&mut self, rhs: I)
fn bitxor_assign(&mut self, rhs: I)
^=
operation. Read moresourceimpl<P: Clone + IntegerParameter> Clone for GenericInteger<P>where
P::InnerCiphertext: Clone,
P::Id: Clone,
impl<P: Clone + IntegerParameter> Clone for GenericInteger<P>where
P::InnerCiphertext: Clone,
P::Id: Clone,
sourcefn clone(&self) -> GenericInteger<P>
fn clone(&self) -> GenericInteger<P>
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'de, P: IntegerParameter> Deserialize<'de> for GenericInteger<P>where
P::Id: Deserialize<'de>,
impl<'de, P: IntegerParameter> Deserialize<'de> for GenericInteger<P>where
P::Id: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl<P> FheBootstrap for GenericInteger<P>where
P: StaticIntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: WopbsExecutor<P, <P as StaticIntegerParameter>::Representation>,
impl<P> FheBootstrap for GenericInteger<P>where
P: StaticIntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: WopbsExecutor<P, <P as StaticIntegerParameter>::Representation>,
sourceimpl<P> FheDecrypt<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: RefKeyFromKeyChain<Key = GenericIntegerClientKey<P>>,
impl<P> FheDecrypt<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: RefKeyFromKeyChain<Key = GenericIntegerClientKey<P>>,
sourceimpl FheEncrypt<u8> for GenericInteger<FheUint8Parameters>
impl FheEncrypt<u8> for GenericInteger<FheUint8Parameters>
sourceimpl<P, T> FheTryEncrypt<T> for GenericInteger<P>where
T: TryInto<u64>,
P: StaticIntegerParameter,
P::Id: RefKeyFromKeyChain<Key = GenericIntegerClientKey<P>> + Default,
impl<P, T> FheTryEncrypt<T> for GenericInteger<P>where
T: TryInto<u64>,
P: StaticIntegerParameter,
P::Id: RefKeyFromKeyChain<Key = GenericIntegerClientKey<P>> + Default,
type Error = OutOfRangeError
fn try_encrypt(value: T, key: &ClientKey) -> Result<Self, Self::Error>
sourceimpl<P, B> Mul<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Mul<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> Mul<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Mul<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the *
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a * b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) * Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a * &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) * Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P> Mul<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Mul<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Mul<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMul<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P, I> MulAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> MulAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn mul_assign(&mut self, rhs: I)
fn mul_assign(&mut self, rhs: I)
*=
operation. Read moresourceimpl<P> MulAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
impl<P> MulAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
sourcefn mul_assign(&mut self, rhs: u16)
fn mul_assign(&mut self, rhs: u16)
*=
operation. Read moresourceimpl<P> MulAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
impl<P> MulAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
sourcefn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresourceimpl<P> MulAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
impl<P> MulAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
sourcefn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresourceimpl<P> MulAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
impl<P> MulAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartMulAssign<P::InnerCiphertext, u64>,
sourcefn mul_assign(&mut self, rhs: u8)
fn mul_assign(&mut self, rhs: u8)
*=
operation. Read moresourceimpl<P> Neg for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartNeg<&'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P> Neg for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartNeg<&'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P> Neg for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: for<'a> SmartNeg<&'a GenericInteger<P>, Output = GenericInteger<P>>,
P::InnerServerKey: for<'a> SmartNeg<&'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P> Neg for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
GenericIntegerServerKey<P>: for<'a> SmartNeg<&'a GenericInteger<P>, Output = GenericInteger<P>>,
P::InnerServerKey: for<'a> SmartNeg<&'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P: IntegerParameter> Serialize for GenericInteger<P>where
P::Id: Serialize,
impl<P: IntegerParameter> Serialize for GenericInteger<P>where
P::Id: Serialize,
sourceimpl<P> Shl<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shl<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shl<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShl<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> ShlAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
impl<P> ShlAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
sourcefn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
<<=
operation. Read moresourceimpl<P> ShlAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
impl<P> ShlAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
sourcefn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
<<=
operation. Read moresourceimpl<P> ShlAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
impl<P> ShlAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
sourcefn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
<<=
operation. Read moresourceimpl<P> ShlAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
impl<P> ShlAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShlAssign<P::InnerCiphertext, u64>,
sourcefn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<=
operation. Read moresourceimpl<P> Shr<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Shr<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Shr<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShr<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> ShrAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
impl<P> ShrAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
sourcefn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
>>=
operation. Read moresourceimpl<P> ShrAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
impl<P> ShrAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
sourcefn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
>>=
operation. Read moresourceimpl<P> ShrAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
impl<P> ShrAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
sourcefn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
>>=
operation. Read moresourceimpl<P> ShrAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
impl<P> ShrAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartShrAssign<P::InnerCiphertext, u64>,
sourcefn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>=
operation. Read moresourceimpl<P, B> Sub<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Sub<B> for &GenericInteger<P>where
P: IntegerParameter,
B: Borrow<GenericInteger<P>>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
sourceimpl<P, B> Sub<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
impl<P, B> Sub<B> for GenericInteger<P>where
P: IntegerParameter,
B: Borrow<Self>,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, &'a mut P::InnerCiphertext, Output = P::InnerCiphertext>,
Allows using the -
operator between a
GenericInteger
and a GenericInteger
or a &GenericInteger
Examples
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(142, &keys)?;
let b = FheUint8::try_encrypt(83, &keys)?;
set_server_key(server_key);
let c = a - b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(142u8) - Wrapping(83u8);
assert_eq!(decrypted, expected.0);
use concrete::prelude::*;
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheUint8};
use std::num::Wrapping;
let config = ConfigBuilder::all_disabled()
.enable_default_uint8()
.build();
let (keys, server_key) = generate_keys(config);
let a = FheUint8::try_encrypt(208, &keys)?;
let b = FheUint8::try_encrypt(29, &keys)?;
set_server_key(server_key);
let c = a - &b;
let decrypted: u8 = c.decrypt(&keys);
let expected = Wrapping(208u8) - Wrapping(29u8);
assert_eq!(decrypted, expected.0);
sourceimpl<P> Sub<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u16> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u32> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u64> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u8> for &GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P> Sub<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
impl<P> Sub<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSub<&'a mut P::InnerCiphertext, u64, Output = P::InnerCiphertext>,
sourceimpl<P, I> SubAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
impl<P, I> SubAssign<I> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, &'a mut P::InnerCiphertext>,
I: Borrow<Self>,
sourcefn sub_assign(&mut self, rhs: I)
fn sub_assign(&mut self, rhs: I)
-=
operation. Read moresourceimpl<P> SubAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
impl<P> SubAssign<u16> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
sourcefn sub_assign(&mut self, rhs: u16)
fn sub_assign(&mut self, rhs: u16)
-=
operation. Read moresourceimpl<P> SubAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
impl<P> SubAssign<u32> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
sourcefn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
-=
operation. Read moresourceimpl<P> SubAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
impl<P> SubAssign<u64> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
sourcefn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-=
operation. Read moresourceimpl<P> SubAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
impl<P> SubAssign<u8> for GenericInteger<P>where
P: IntegerParameter,
P::Id: WithGlobalKey<Key = GenericIntegerServerKey<P>>,
P::InnerServerKey: for<'a> SmartSubAssign<P::InnerCiphertext, u64>,
sourcefn sub_assign(&mut self, rhs: u8)
fn sub_assign(&mut self, rhs: u8)
-=
operation. Read more