mirror of
https://github.com/arnaucube/phantom-zone.git
synced 2026-01-11 16:41:29 +01:00
add example
This commit is contained in:
@@ -26,8 +26,16 @@ static BOOL_SERVER_KEY: OnceLock<ShoupServerKeyEvaluationDomain<Vec<Vec<u64>>>>
|
||||
|
||||
static MULTI_PARTY_CRS: OnceLock<MultiPartyCrs<[u8; 32]>> = OnceLock::new();
|
||||
|
||||
pub fn set_parameter_set(parameter: &BoolParameters<u64>) {
|
||||
BOOL_EVALUATOR.with_borrow_mut(|v| *v = Some(BoolEvaluator::new(parameter.clone())));
|
||||
pub enum ParameterSelector {
|
||||
MultiPartyLessThan16,
|
||||
}
|
||||
|
||||
pub fn set_parameter_set(select: ParameterSelector) {
|
||||
match select {
|
||||
ParameterSelector::MultiPartyLessThan16 => {
|
||||
BOOL_EVALUATOR.with_borrow_mut(|v| *v = Some(BoolEvaluator::new(SMALL_MP_BOOL_PARAMS)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_mp_seed(seed: [u8; 32]) {
|
||||
|
||||
@@ -3,7 +3,7 @@ use num_traits::{ConstZero, FromPrimitive, PrimInt};
|
||||
use crate::{backend::Modulus, decomposer::Decomposer};
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub(crate) struct BoolParameters<El> {
|
||||
pub struct BoolParameters<El> {
|
||||
rlwe_q: CiphertextModulus<El>,
|
||||
lwe_q: CiphertextModulus<El>,
|
||||
br_q: usize,
|
||||
@@ -181,7 +181,7 @@ pub(crate) struct PolynomialSize(pub(crate) usize);
|
||||
|
||||
/// T equals modulus when modulus is non-native. Otherwise T equals 0. bool is
|
||||
/// true when modulus is native, false otherwise.
|
||||
pub(crate) struct CiphertextModulus<T>(T, bool);
|
||||
pub struct CiphertextModulus<T>(T, bool);
|
||||
|
||||
impl<T: ConstZero> CiphertextModulus<T> {
|
||||
const fn new_native() -> Self {
|
||||
|
||||
Reference in New Issue
Block a user