viff

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 diff
     1.1 --- a/viff/paillier.py	Wed May 27 22:29:31 2009 +0200
     1.2 +++ b/viff/paillier.py	Fri Jun 19 09:05:00 2009 +0200
     1.3 @@ -56,6 +56,9 @@
     1.4  
     1.5  def encrypt(m, (n, g)):
     1.6      r = rand.randint(1, long(n))
     1.7 +    return encrypt_r(m, r, (n, g))
     1.8 +
     1.9 +def encrypt_r(m, r, (n, g)):
    1.10      nsq = n*n
    1.11      return (pow(g, m, nsq)*pow(r, n, nsq)) % nsq
    1.12