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

Extract bits of an LWE ciphertext.

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