pub trait LweSeededCiphertextVectorEncryptionEngine<SecretKey, PlaintextVector, CiphertextVector>: AbstractEnginewhere
SecretKey: LweSecretKeyEntity,
PlaintextVector: PlaintextVectorEntity,
CiphertextVector: LweSeededCiphertextVectorEntity,{
fn encrypt_lwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, LweSeededCiphertextVectorEncryptionError<Self::EngineError>>;
unsafe fn encrypt_lwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector;
}
Expand description
A trait for engines encrypting seeded LWE ciphertext vectors.
Semantics
This pure operation generates a seeded LWE ciphertext vector
containing the element-wise encryption of the input
plaintext vector, under the key
secret
key.
Formal Definition
Seeded LWE vector encryption
inputs:
- $\vec{\mathsf{pt}}\in\mathbb{Z}_q^t$: a plaintext vector
- $\vec{s}\in\mathbb{Z}_q^n$: a secret key
- $\mathsf{seed} \in\mathcal{S}$: a public seed
- $G$: a CSPRNG working with seeds from $\mathcal{S}$
- $\mathcal{D}_{\sigma^2,\mu}$: a normal distribution of variance $\sigma^2$ and mean $\mu$
outputs:
- $\vec{\tilde{\mathsf{ct}}} = \left( \mathsf{seed} , \vec{b}\right) \in \mathsf{SeededLWEVector}^{n, t}_{\vec{s}, G}( \vec{\mathsf{pt}})\subseteq \mathcal{S}\times \mathbb{Z}_q^t$: a seeded LWE ciphertext vector
algorithm:
- let $\vec{b} \in \mathbb{Z}_q^t$
- Seed $G$ with the seed $\mathsf{seed}\in\mathcal{S}$
- for each $(b_i, \mathsf{pt_i})$ in $(\vec{b}, \vec{\mathsf{pt}})$
- uniformly sample $n$ integers in $\mathbb{Z}_q$ from $G$ and store them in $\vec{a}\in\mathbb{Z}^n_q$
- sample an integer error term $e \hookleftarrow\mathcal{D}_{\sigma^2,\mu}$
- compute $b_i = \left\langle \vec{a} , \vec{s} \right\rangle + \mathsf{pt_i} + e \in\mathbb{Z}_q$
- output $\left( \mathsf{seed} , \vec{b}\right)$
Required Methods
sourcefn encrypt_lwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, LweSeededCiphertextVectorEncryptionError<Self::EngineError>>
fn encrypt_lwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, LweSeededCiphertextVectorEncryptionError<Self::EngineError>>
Encrypts a seeded LWE ciphertext vector.
sourceunsafe fn encrypt_lwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector
unsafe fn encrypt_lwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector
Unsafely encrypts a seeded LWE ciphertext vector.
Safety
For the general safety concerns regarding this operation, refer to the different variants
of LweSeededCiphertextVectorEncryptionError
. For safety concerns specific to an
engine, refer to the implementer safety section.
Implementors
impl LweSeededCiphertextVectorEncryptionEngine<LweSecretKey32, PlaintextVector32, LweSeededCiphertextVector32> for DefaultEngine
Description:
Implementation of LweSeededCiphertextVectorEncryptionEngine
for DefaultEngine
that
operates on 32 bits integers.
impl LweSeededCiphertextVectorEncryptionEngine<LweSecretKey64, PlaintextVector64, LweSeededCiphertextVector64> for DefaultEngine
Description:
Implementation of LweSeededCiphertextVectorEncryptionEngine
for DefaultEngine
that
operates on 64 bits integers.