From 9cfb19ea7859944f6547569776a6685c4d7dcf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Pr=C3=BC=C3=9Fner?= Date: Fri, 2 May 2014 12:18:33 +0200 Subject: [PATCH] added commentary and implemented the pseudocode algorithm (ms_corourke.pdf) --- src/ntru_decrypt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ntru_decrypt.c b/src/ntru_decrypt.c index d385959..3a46676 100644 --- a/src/ntru_decrypt.c +++ b/src/ntru_decrypt.c @@ -19,6 +19,18 @@ * MA 02110-1301 USA */ +// Require: N , q, p, secret key f , inverse polynomial Fp , and encrypted message e. int ntru_decrypt(char *encr_msg, pb_poly *private_key, ntru_context *context, char ** decr_msg){ + // StarMultiply(f, e, a, N, q) + for(int i = 0, i < N, i++){ + if(a[i] < 0 ) { + a[i] = a[i] + q; // Make all coefficients positive + } + if(a[i] > q/2) { + a[i] = a[i] - q // Shift coefficients of a into range (−q/2, q/2) + } + } + // StarMultiply(a, Fp , d, N, p) + // {Decode returns the decrypted message, d, through the argument list.} return 0; }