ct, pk, sk, ksk for glwe and lwe

This commit is contained in:
Rasoul Akhavan Mahdavi
2025-10-16 17:42:39 -04:00
parent cf62c82f48
commit a5600593ca
7 changed files with 345 additions and 159 deletions

View File

@@ -23,10 +23,20 @@ impl<DataSelf: DataMut> LWE<DataSelf> {
}
}
pub trait LWEEncryptSk<BE: Backend>
where
Self: Sized + ZnFillUniform + ZnAddNormal + ZnNormalizeInplace<BE>,
{
fn lwe_encrypt_sk<R, P, S>(&self, res: &mut R, pt: &P, sk: &S, source_xa: &mut Source, source_xe: &mut Source)
where
R: LWEToMut,
P: LWEPlaintextToRef,
S: LWESecretToRef,
BE: Backend + ScratchOwnedAllocImpl<BE> + ScratchOwnedBorrowImpl<BE>;
}
impl<BE: Backend> LWEEncryptSk<BE> for Module<BE> where
Self: Sized + ZnFillUniform + ZnAddNormal + ZnNormalizeInplace<BE>,
{
fn lwe_encrypt_sk<R, P, S>(&self, res: &mut R, pt: &P, sk: &S, source_xa: &mut Source, source_xe: &mut Source)
where
@@ -93,9 +103,4 @@ where
res.data.at_mut(0, i)[0] = tmp_znx.at(0, i)[0];
});
}
}
impl<BE: Backend> LWEEncryptSk<BE> for Module<BE> where
Self: Sized + ZnFillUniform + ZnAddNormal + ZnNormalizeInplace<BE>,
{
}