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:
  1. let $\vec{b} \in \mathbb{Z}_q^t$
  2. Seed $G$ with the seed $\mathsf{seed}\in\mathcal{S}$
  3. 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$
  4. output $\left( \mathsf{seed} , \vec{b}\right)$

Required Methods

Encrypts a seeded LWE ciphertext vector.

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