From de62bcd41208b90bcb5ab19030cf06a2a076d950 Mon Sep 17 00:00:00 2001 From: "hilder.vitor" Date: Fri, 11 Mar 2022 12:45:36 +0100 Subject: [PATCH] SchemeNTRU::not_gate implemented --- include/ntruhe.h | 7 +++++++ src/ntruhe.cpp | 4 ++++ 2 files changed, 11 insertions(+) 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); +}