diff --git a/include/ntruhe.h b/include/ntruhe.h index b822b27..46eea2b 100644 --- a/include/ntruhe.h +++ b/include/ntruhe.h @@ -173,6 +173,13 @@ class SchemeNTRU */ void xor_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct1, const Ctxt_NTRU& ct2) const; + /** + * Computes the NOT gate of a given ciphertext ct + * @param[out] ct_res encryption of the outuput of the NOT gate + * @param[in] ct encryption of the input bit + */ + void not_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct) const; + }; #endif diff --git a/src/ntruhe.cpp b/src/ntruhe.cpp index 5e53391..d4868d4 100644 --- a/src/ntruhe.cpp +++ b/src/ntruhe.cpp @@ -296,4 +296,8 @@ void SchemeNTRU::xor_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct1, const Ctxt_NT bootstrap(ct_res); } +void SchemeNTRU::not_gate(Ctxt_NTRU& ct_res, const Ctxt_NTRU& ct) const +{ + nand_gate(ct_res, ct, ct); +}