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:
- Compute $\vec{A}’ = -\vec{A} \in\mathcal{R}^k_q$
- Compute $B’ = -B \in\mathcal{R}_q$
- Output $\left( \vec{A} , B \right)$
Required Methods
sourcefn discard_opp_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertext,
input: &InputCiphertext
) -> Result<(), LweCiphertextDiscardingOppositeError<Self::EngineError>>
fn discard_opp_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertext,
input: &InputCiphertext
) -> Result<(), LweCiphertextDiscardingOppositeError<Self::EngineError>>
Computes the opposite of an LWE ciphertext.
sourceunsafe fn discard_opp_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertext,
input: &InputCiphertext
)
unsafe fn discard_opp_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertext,
input: &InputCiphertext
)
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
impl LweCiphertextDiscardingOppositeEngine<LweCiphertext32, LweCiphertext32> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingOppositeEngine
for DefaultEngine
that operates
on 32 bits integers.
impl LweCiphertextDiscardingOppositeEngine<LweCiphertext64, LweCiphertext64> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingOppositeEngine
for DefaultEngine
that operates
on 64 bits integers.
impl LweCiphertextDiscardingOppositeEngine<LweCiphertextView32<'_>, LweCiphertextMutView32<'_>> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingOppositeEngine
for DefaultEngine
that operates
on views containing 32 bits integers.
impl LweCiphertextDiscardingOppositeEngine<LweCiphertextView64<'_>, LweCiphertextMutView64<'_>> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingOppositeEngine
for DefaultEngine
that operates
on views containing 64 bits integers.