mirror of
https://github.com/arnaucube/phantom-zone.git
synced 2026-01-11 16:41:29 +01:00
add modulus operator for power of 2 modulus
This commit is contained in:
@@ -12,14 +12,14 @@ use keys::*;
|
||||
use parameters::*;
|
||||
|
||||
use crate::{
|
||||
backend::ModularOpsU64,
|
||||
backend::{ModularOpsU64, ModulusPowerOf2},
|
||||
ntt::NttBackendU64,
|
||||
random::{DefaultSecureRng, NewWithSeed},
|
||||
utils::{Global, WithLocal},
|
||||
};
|
||||
|
||||
thread_local! {
|
||||
static BOOL_EVALUATOR: RefCell<Option<BoolEvaluator<Vec<Vec<u64>>, NttBackendU64, ModularOpsU64<CiphertextModulus<u64>>, ModularOpsU64<CiphertextModulus<u64>>, ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>>>> = RefCell::new(None);
|
||||
static BOOL_EVALUATOR: RefCell<Option<BoolEvaluator<Vec<Vec<u64>>, NttBackendU64, ModularOpsU64<CiphertextModulus<u64>>, ModulusPowerOf2<CiphertextModulus<u64>>, ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>>>> = RefCell::new(None);
|
||||
|
||||
}
|
||||
static BOOL_SERVER_KEY: OnceLock<ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>> = OnceLock::new();
|
||||
@@ -138,7 +138,7 @@ impl WithLocal
|
||||
Vec<Vec<u64>>,
|
||||
NttBackendU64,
|
||||
ModularOpsU64<CiphertextModulus<u64>>,
|
||||
ModularOpsU64<CiphertextModulus<u64>>,
|
||||
ModulusPowerOf2<CiphertextModulus<u64>>,
|
||||
ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>,
|
||||
>
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ mod test {
|
||||
use itertools::{izip, Itertools};
|
||||
|
||||
use crate::{
|
||||
backend::{ArithmeticOps, ModularOpsU64, Modulus},
|
||||
backend::{ArithmeticOps, ModularOpsU64, Modulus, ModulusPowerOf2},
|
||||
bool::{
|
||||
set_parameter_set, BoolEncoding, BoolEvaluator, BooleanGates, CiphertextModulus,
|
||||
ClientKey, PublicKey, ServerKeyEvaluationDomain, ShoupServerKeyEvaluationDomain,
|
||||
@@ -24,7 +24,7 @@ mod test {
|
||||
Vec<Vec<u64>>,
|
||||
NttBackendU64,
|
||||
ModularOpsU64<CiphertextModulus<u64>>,
|
||||
ModularOpsU64<CiphertextModulus<u64>>,
|
||||
ModulusPowerOf2<CiphertextModulus<u64>>,
|
||||
ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>,
|
||||
>::new(SMALL_MP_BOOL_PARAMS);
|
||||
|
||||
@@ -103,9 +103,9 @@ mod test {
|
||||
// let mut stats = Stats::new();
|
||||
|
||||
for _ in 0..1000 {
|
||||
// let now = std::time::Instant::now();
|
||||
let now = std::time::Instant::now();
|
||||
let c_out = evaluator.xor(&c_m0, &c_m1, &runtime_server_key);
|
||||
// println!("Gate time: {:?}", now.elapsed());
|
||||
println!("Gate time: {:?}", now.elapsed());
|
||||
|
||||
// mp decrypt
|
||||
let decryption_shares = cks
|
||||
|
||||
Reference in New Issue
Block a user