mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
dbg normalize check
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use poulpy_core::{
|
||||
GLWESub, SIGMA,
|
||||
layouts::{
|
||||
Base2K, Degree, GLWE, GLWELayout, GLWEPlaintext, GLWEPlaintextLayout, GLWESecret, LWEInfos, Rank, TorusPrecision,
|
||||
prepared::GLWESecretPrepared,
|
||||
prepared::GLWESecretPrepared, Base2K, Degree, GLWELayout, GLWEPlaintext, GLWEPlaintextLayout, GLWESecret, LWEInfos, Rank,
|
||||
TorusPrecision, GLWE,
|
||||
},
|
||||
GLWESub, SIGMA,
|
||||
};
|
||||
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64"))]
|
||||
@@ -71,18 +71,38 @@ fn main() {
|
||||
let mut sk_prepared: GLWESecretPrepared<Vec<u8>, BackendImpl> = GLWESecretPrepared::alloc(&module, rank);
|
||||
sk_prepared.prepare(&module, &sk);
|
||||
|
||||
// DBG:
|
||||
// obtain pk from sk
|
||||
let mut pk = poulpy_core::layouts::GLWEPublicKey::alloc_from_infos(&glwe_ct_infos);
|
||||
pk.generate(&module, &sk_prepared, &mut source_xa, &mut source_xe);
|
||||
// Backend-prepared publickey:
|
||||
let mut pk_prepared: poulpy_core::layouts::GLWEPublicKeyPrepared<Vec<u8>, BackendImpl> =
|
||||
poulpy_core::layouts::GLWEPublicKeyPrepared::alloc(&module, base2k, k_ct, rank);
|
||||
pk_prepared.prepare(&module, &pk);
|
||||
|
||||
// Uniform plaintext
|
||||
module.vec_znx_fill_uniform(base2k.into(), &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
// Encryption
|
||||
ct.encrypt_sk(
|
||||
// ct.encrypt_sk(
|
||||
// &module,
|
||||
// &pt_want,
|
||||
// &sk_prepared,
|
||||
// &mut source_xa,
|
||||
// &mut source_xe,
|
||||
// scratch.borrow(),
|
||||
// );
|
||||
|
||||
// DBG: encrypt with public key
|
||||
ct.encrypt_pk(
|
||||
&module,
|
||||
&pt_want,
|
||||
&sk_prepared,
|
||||
&pk_prepared,
|
||||
&mut source_xa,
|
||||
&mut source_xe,
|
||||
scratch.borrow(),
|
||||
);
|
||||
dbg!("encrypted");
|
||||
|
||||
// Decryption
|
||||
ct.decrypt(&module, &mut pt_have, &sk_prepared, scratch.borrow());
|
||||
|
||||
Reference in New Issue
Block a user