pub trait LweCiphertextDiscardingBitExtractEngine<BootstrapKey, KeyswitchKey, InputCiphertext, OutputCiphertextVector>: AbstractEnginewhere
BootstrapKey: LweBootstrapKeyEntity,
KeyswitchKey: LweKeyswitchKeyEntity,
InputCiphertext: LweCiphertextEntity,
OutputCiphertextVector: LweCiphertextVectorEntity,{
fn discard_extract_bits_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
) -> Result<(), LweCiphertextDiscardingBitExtractError<Self::EngineError>>;
unsafe fn discard_extract_bits_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
);
}
Expand description
A trait for engines doing a (discarding) bit extract over LWE ciphertexts.
Semantics
This discarding operation fills the output
LWE ciphertext vector
with the bit extraction of the input
LWE ciphertext, extracting number_of_bits_to_extract
bits starting from the bit at index delta_log
(0-indexed) included, and going towards the
most significant bits.
Output bits are ordered from the MSB to the LSB. Each one of them is output in a distinct LWE ciphertext, containing the encryption of the bit scaled by q/2 (i.e., the most significant bit in the plaintext representation).
Formal Definition
This function takes as input an [LWE ciphertext
]
(crate::specification::entities::LweCiphertextEntity)
$$\mathsf{ct} = \mathsf{LWE}^n_{\vec{s}}( \mathsf{m}) \subseteq \mathbb{Z}_q^{(n+1)}$$
which encrypts some message m
. We extract bits $m_i$ of this message into individual LWE
ciphertexts. Each of these ciphertexts contains an encryption of $m_i \cdot q/2$, i.e.
$$\mathsf{ct_i} = \mathsf{LWE}^n_{\vec{s}}( \mathsf{m_i} \cdot q/2 )$$. The number of
output LWE ciphertexts is determined by the number_of_bits_to_extract
input parameter.
Required Methods
sourcefn discard_extract_bits_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
) -> Result<(), LweCiphertextDiscardingBitExtractError<Self::EngineError>>
fn discard_extract_bits_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
) -> Result<(), LweCiphertextDiscardingBitExtractError<Self::EngineError>>
Extract bits of an LWE ciphertext.
sourceunsafe fn discard_extract_bits_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
)
unsafe fn discard_extract_bits_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertextVector,
input: &InputCiphertext,
bsk: &BootstrapKey,
ksk: &KeyswitchKey,
extracted_bits_count: ExtractedBitsCount,
delta_log: DeltaLog
)
Unsafely extract bits of an LWE ciphertext.
Safety
For the general safety concerns regarding this operation, refer to the different variants
of LweCiphertextDiscardingBitExtractError
. For safety concerns specific to an engine,
refer to the implementer safety section.
Implementors
impl LweCiphertextDiscardingBitExtractEngine<FftFourierLweBootstrapKey32, LweKeyswitchKey32, LweCiphertext32, LweCiphertextVector32> for FftEngine
Description:
Implementation of LweCiphertextDiscardingBitExtractEngine
for FftEngine
that operates
on 32 bits integers.
impl LweCiphertextDiscardingBitExtractEngine<FftFourierLweBootstrapKey32, LweKeyswitchKey32, LweCiphertextView32<'_>, LweCiphertextVectorMutView32<'_>> for FftEngine
Description:
Implementation of LweCiphertextDiscardingBitExtractEngine
for FftEngine
that operates
on views containing 32 bits integers.
impl LweCiphertextDiscardingBitExtractEngine<FftFourierLweBootstrapKey64, LweKeyswitchKey64, LweCiphertext64, LweCiphertextVector64> for FftEngine
Description:
Implementation of LweCiphertextDiscardingBitExtractEngine
for FftEngine
that operates
on 64 bits integers.
impl LweCiphertextDiscardingBitExtractEngine<FftFourierLweBootstrapKey64, LweKeyswitchKey64, LweCiphertextView64<'_>, LweCiphertextVectorMutView64<'_>> for FftEngine
Description:
Implementation of LweCiphertextDiscardingBitExtractEngine
for FftEngine
that operates
on views containing 64 bits integers.