changeset 1192:c1259ceebc55

Added a variant of the encryption method which takes a random value as argument.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Fri, 19 Jun 2009 09:05:00 +0200
parents 8ec45943c12a
children ef0499add96c
files viff/paillier.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/paillier.py	Wed May 27 22:29:31 2009 +0200
+++ b/viff/paillier.py	Fri Jun 19 09:05:00 2009 +0200
@@ -56,6 +56,9 @@
 
 def encrypt(m, (n, g)):
     r = rand.randint(1, long(n))
+    return encrypt_r(m, r, (n, g))
+
+def encrypt_r(m, r, (n, g)):
     nsq = n*n
     return (pow(g, m, nsq)*pow(r, n, nsq)) % nsq