pub trait LweCiphertextDiscardingOppositeEngine<InputCiphertext, OutputCiphertext>: AbstractEnginewhere
    InputCiphertext: LweCiphertextEntity,
    OutputCiphertext: LweCiphertextEntity,
{ fn discard_opp_lwe_ciphertext(
        &mut self,
        output: &mut OutputCiphertext,
        input: &InputCiphertext
    ) -> Result<(), LweCiphertextDiscardingOppositeError<Self::EngineError>>; unsafe fn discard_opp_lwe_ciphertext_unchecked(
        &mut self,
        output: &mut OutputCiphertext,
        input: &InputCiphertext
    ); }
Expand description

A trait for engines computing the opposite (discarding) LWE ciphertexts.

Semantics

This discarding operation fills the output LWE ciphertext with the opposite of the input LWE ciphertext.

Formal Definition

LWE opposite computation

This is a specification of the compuation of the opposite of a GLWE ciphertext, described below.

GLWE opposite computation

It is easy to compute the opposite of a GLWE ciphertext, i.e., a GLWE ciphertext encrypting the opposite of the encrypted plaintext. Let a GLWE ciphertext $$ \mathsf{CT} = \left( \vec{A}, B\right) \in \mathsf{GLWE}_{\vec{S}} \left( \mathsf{PT} \right) \subseteq \mathcal{R}_q^{k+1} $$ encrypted under the GLWE secret key $\vec{S} \in \mathcal{R}_q^k$. We can compute the opposite of this GLWE ciphertext and obtain as a result a new GLWE ciphertext encrypting the opposite of the plaintext $- \mathsf{PT}$.

inputs:
  • $\mathsf{CT} = \left( \vec{A}, B\right) \in \mathsf{GLWE}_{\vec{S}} \left( \mathsf{PT} \right) \subseteq \mathcal{R}_q^{k+1}$: a GLWE ciphertext
outputs:
  • $\mathsf{CT}’ = \left( \vec{A}’ , B’ \right) \in \mathsf{GLWE}_{\vec{S}}( -\mathsf{PT} )\subseteq \mathcal{R}_q^{k+1}$: an GLWE ciphertext
algorithm:
  1. Compute $\vec{A}’ = -\vec{A} \in\mathcal{R}^k_q$
  2. Compute $B’ = -B \in\mathcal{R}_q$
  3. Output $\left( \vec{A} , B \right)$

Required Methods

Computes the opposite of an LWE ciphertext.

Unsafely computes the opposite of an LWE ciphertext.

Safety

For the general safety concerns regarding this operation, refer to the different variants of LweCiphertextDiscardingOppositeError. For safety concerns specific to an engine, refer to the implementer safety section.

Implementors