pub struct ReRandomizationContext { /* private fields */ }Expand description
The context that will be hashed and used to generate unique ReRandomizationSeed.
Implementations§
Source§impl ReRandomizationContext
impl ReRandomizationContext
Sourcepub fn new<'a>(
rerand_seeder_domain_separator: [u8; 8],
fn_description: impl IntoIterator<Item = &'a [u8]>,
public_encryption_domain_separator: [u8; 8],
) -> Self
pub fn new<'a>( rerand_seeder_domain_separator: [u8; 8], fn_description: impl IntoIterator<Item = &'a [u8]>, public_encryption_domain_separator: [u8; 8], ) -> Self
Create a new re-randomization context with the default seed hasher (blake3).
rerand_seeder_domain_separator is the domain separator that will be fed into the
seed generator.
public_encryption_domain_separator is the domain separator that will be used along this
seed to generate the encryptions of zero.
fn_description is a unique sequence of bytes that represents the functions called on the
re-randomized values.
(See XofSeed for more information)
§Example
use tfhe::integer::ciphertext::ReRandomizationContext;
// Simulate a 256 bits nonce
let nonce: [u8; 256 / 8] = core::array::from_fn(|_| rand::random());
let _re_rand_context = ReRandomizationContext::new(
*b"TFHE_Rrd",
[b"FheUint64+FheUint64".as_slice(), &nonce],
*b"TFHE_Enc"
);Sourcepub fn new_with_hasher<'a>(
fn_description: impl IntoIterator<Item = &'a [u8]>,
public_encryption_domain_separator: [u8; 8],
seed_hasher: ReRandomizationSeedHasher,
) -> Self
pub fn new_with_hasher<'a>( fn_description: impl IntoIterator<Item = &'a [u8]>, public_encryption_domain_separator: [u8; 8], seed_hasher: ReRandomizationSeedHasher, ) -> Self
Create a new re-randomization context with the provided seed hasher.
Sourcepub fn add_ciphertext<T: AsShortintCiphertextSlice>(&mut self, ciphertext: &T)
pub fn add_ciphertext<T: AsShortintCiphertextSlice>(&mut self, ciphertext: &T)
Add a new integer ciphertext to the context.
The ciphertexts added like this will be stored in a temporary buffer and only hashed during the “finalize” step
pub fn add_proven_ciphertext_list(&mut self, list: &ProvenCompactCiphertextList)
Sourcepub fn add_bytes(&mut self, data: &[u8])
pub fn add_bytes(&mut self, data: &[u8])
Add a metadata buffer to the context.
These bytes will be added to a temporary buffer and will only be hashed during the “finalize” step
Sourcepub fn finalize(self) -> ReRandomizationSeedGen
pub fn finalize(self) -> ReRandomizationSeedGen
Consumes the context to instantiate a seed generator
Auto Trait Implementations§
impl Freeze for ReRandomizationContext
impl RefUnwindSafe for ReRandomizationContext
impl Send for ReRandomizationContext
impl Sync for ReRandomizationContext
impl Unpin for ReRandomizationContext
impl UnsafeUnpin for ReRandomizationContext
impl UnwindSafe for ReRandomizationContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more