pub trait LweCiphertextDiscardingAdditionEngine<InputCiphertext, OutputCiphertext>: AbstractEngine where
InputCiphertext: LweCiphertextEntity,
OutputCiphertext: LweCiphertextEntity<KeyDistribution = InputCiphertext::KeyDistribution>, {
fn discard_add_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
) -> Result<(), LweCiphertextDiscardingAdditionError<Self::EngineError>>;
unsafe fn discard_add_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
);
}
Expand description
A trait for engines adding (discarding) LWE ciphertexts.
Semantics
This discarding operation fills the output
LWE ciphertext with
the addition of the input_1
LWE ciphertext and the input_2
LWE ciphertext.
Formal Definition
LWE homomorphic addition
It is a specification of the GLWE homomorphic addition described below.
GLWE homomorphic addition
GLWE ciphertexts
are homomorphic
with
respect to the addition.
Let two GLWE ciphertexts
$$
\begin{cases}
\mathsf{CT}_1 = \left( \vec{A}_1, B_1\right) \in \mathsf{GLWE}_{\vec{S}} \left(
\mathsf{PT}_1 \right) \subseteq \mathcal{R}_q^{k+1} \ \mathsf{CT}_2 = \left( \vec{A}_2,
B_2\right) \in \mathsf{GLWE}_{\vec{S}} \left( \mathsf{PT}_2 \right) \subseteq
\mathcal{R}_q^{k+1} \end{cases} $$
encrypted under the same
GLWE secret key
$\vec{S} \in
\mathcal{R}_q^k$. We can add these ciphertexts homomorhically and obtain as a result a new GLWE
ciphertext encrypting the sum of the two plaintexts $\mathsf{PT}_1 + \mathsf{PT}_2$.
inputs:
- $\mathsf{CT}_1 = \left( \vec{A}_1, B_1\right) \in \mathsf{GLWE}_{\vec{S}} \left( \mathsf{PT}_1 \right) \subseteq \mathcal{R}_q^{k+1}$: a GLWE ciphertext
- $\mathsf{CT}_2 = \left( \vec{A}_2, B_2\right) \in \mathsf{GLWE}_{\vec{S}} \left( \mathsf{PT}_2 \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}_1 + \mathsf{PT}_2 )\subseteq \mathcal{R}_q^{k+1}$: an GLWE ciphertext
algorithm:
- Compute $\vec{A} = \vec{A}_1 + \vec{A}_2 \in\mathcal{R}^k_q$
- Compute $B = B_1 + B_2 \in\mathcal{R}_q$
- Output $\left( \vec{A} , B \right)$
Required Methods
fn discard_add_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
) -> Result<(), LweCiphertextDiscardingAdditionError<Self::EngineError>>
fn discard_add_lwe_ciphertext(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
) -> Result<(), LweCiphertextDiscardingAdditionError<Self::EngineError>>
Adds two LWE ciphertexts.
unsafe fn discard_add_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
)
unsafe fn discard_add_lwe_ciphertext_unchecked(
&mut self,
output: &mut OutputCiphertext,
input_1: &InputCiphertext,
input_2: &InputCiphertext
)
Unsafely adds two LWE ciphertexts.
Safety
For the general safety concerns regarding this operation, refer to the different variants
of LweCiphertextDiscardingAdditionError
. For safety concerns specific to an engine,
refer to the implementer safety section.
Implementors
impl LweCiphertextDiscardingAdditionEngine<LweCiphertext32, LweCiphertext32> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingAdditionEngine
for DefaultEngine
that operates
on 32 bits integers.
impl LweCiphertextDiscardingAdditionEngine<LweCiphertext64, LweCiphertext64> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingAdditionEngine
for DefaultEngine
that operates
on 64 bits integers.
impl LweCiphertextDiscardingAdditionEngine<LweCiphertextView32<'_>, LweCiphertextMutView32<'_>> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingAdditionEngine
for DefaultEngine
that operates
on views containing 32 bits integers.
impl LweCiphertextDiscardingAdditionEngine<LweCiphertextView64<'_>, LweCiphertextMutView64<'_>> for DefaultEngine
Description:
Implementation of LweCiphertextDiscardingAdditionEngine
for DefaultEngine
that operates
on on views containing 64 bits integers.