mirror of
https://github.com/mii443/FINAL.git
synced 2025-08-22 15:05:36 +00:00
Created ct_not_const to speed up SchemeNTRU::not_gate
This commit is contained in:
@ -74,6 +74,7 @@ class SchemeNTRU
|
||||
Ctxt_NTRU ct_nand_const;
|
||||
Ctxt_NTRU ct_and_const;
|
||||
Ctxt_NTRU ct_or_const;
|
||||
Ctxt_NTRU ct_not_const;
|
||||
|
||||
void mask_constant(Ctxt_NTRU& ct, int constant);
|
||||
|
||||
@ -98,6 +99,13 @@ class SchemeNTRU
|
||||
//cout << "Encryption of OR: " << float(clock()-start)/CLOCKS_PER_SEC << endl;
|
||||
}
|
||||
|
||||
inline void set_not_const()
|
||||
{
|
||||
encrypt(ct_not_const, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
SchemeNTRU()
|
||||
@ -112,6 +120,7 @@ class SchemeNTRU
|
||||
set_nand_const();
|
||||
set_and_const();
|
||||
set_or_const();
|
||||
set_not_const();
|
||||
}
|
||||
/**
|
||||
* Encrypts a bit using matrix NTRU.
|
||||
|
@ -298,6 +298,7 @@ void SchemeNTRU::xor_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct1, const Ctxt_NT
|
||||
|
||||
void SchemeNTRU::not_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct) const
|
||||
{
|
||||
nand_gate(ct_res, ct, ct);
|
||||
ct_res = ct_not_const;
|
||||
ct_res -= ct;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user