samettonyali / thep

Automatically exported from code.google.com/p/thep
1 stars 0 forks source link

Copy constructor does not properly initialize rng #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Mike,

I'm using the "thep-0.1.jar" (http://code.google.com/p/thep/).  It works well, 
but recently I met one problem on the "EncryptedInteger.rerandomize" which 
fires "java.lang.NullPointerException".  My test code as follows, am I using 
something wrong?

========

import java.math.*;
import thep.paillier.*;
import thep.paillier.exceptions.*;

public class testHE {
    public static void main(String[] args) throws PublicKeysNotEqualException {
        PrivateKey pri_key = new PrivateKey(1024);
        PublicKey pub_key = pri_key.getPublicKey();

        EncryptedInteger[] ei = new EncryptedInteger[100];

        for (int i = 0; i < 100; ++i)
        {
            ei[i] = new EncryptedInteger (new BigInteger (String.valueOf(i + 1)), pub_key);
        }

        EncryptedInteger sum = new EncryptedInteger (BigInteger.ZERO, pub_key);

        for (int i = 0; i < 100; ++i)
        {
            sum = sum.add(ei[i]);
        }

        System.out.println(sum.decrypt(pri_key));

        sum.rerandomize();
        System.out.println(sum.decrypt(pri_key));
    }
}

========

Original issue reported on code.google.com by undefinedspace on 23 Mar 2011 at 10:55

GoogleCodeExporter commented 9 years ago
Fixed in trunk. Working on a thep-0.1.1.jar that will fix this.

Original comment by undefinedspace on 23 Mar 2011 at 10:55

GoogleCodeExporter commented 9 years ago
Uploaded thep-0.1.1 which includes this fix.

Original comment by undefinedspace on 25 Mar 2011 at 9:00