Typo fixes
parent
19e52344f5
commit
f5410bedf4
|
@ -43,7 +43,7 @@ public class CreateTestVector {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
randomMixer = new Random();
|
||||
randomProver = new Random();
|
||||
randomOracle = new DigestOracle();
|
||||
|
@ -61,7 +61,7 @@ public class CreateTestVector {
|
|||
List<Crypto.RerandomizableEncryptedMessage> result = new ArrayList<Crypto.RerandomizableEncryptedMessage>();
|
||||
Voting.PlaintextBallot msg;
|
||||
for (int i = 0; i < n ; i++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
result.add(encryptor.encrypt(msg, encryptor.generateRandomness(random)));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class MixingText {
|
||||
public class MixingTest {
|
||||
|
||||
ECElGamalEncryption encryptor;
|
||||
ECGroup group;
|
||||
|
@ -43,7 +43,7 @@ public class MixingText {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
randomMixer = new Random();
|
||||
randomProver = new Random();
|
||||
randomOracle = new DigestOracle();
|
||||
|
@ -61,7 +61,7 @@ public class MixingText {
|
|||
List<Crypto.RerandomizableEncryptedMessage> result = new ArrayList<Crypto.RerandomizableEncryptedMessage>();
|
||||
Voting.PlaintextBallot msg;
|
||||
for (int i = 0; i < n ; i++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
result.add(encryptor.encrypt(msg, encryptor.generateRandomness(random)));
|
||||
}
|
||||
return result;
|
|
@ -35,7 +35,7 @@ public class RerandomizeTest {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
RandomOracle randomOracle = new DigestOracle();
|
||||
|
@ -48,7 +48,7 @@ public class RerandomizeTest {
|
|||
}
|
||||
|
||||
public void oneRerandomizeTest() throws InvalidProtocolBufferException {
|
||||
Voting.PlaintextBallot msg = Utiles.genRandomBallot(2,3,16); // 2 questions with 3 answers each, in range 0-15.
|
||||
Voting.PlaintextBallot msg = Utils.genRandomBallot(2,3,16); // 2 questions with 3 answers each, in range 0-15.
|
||||
|
||||
Crypto.EncryptionRandomness r = enc.generateRandomness(rand);
|
||||
|
||||
|
@ -56,8 +56,8 @@ public class RerandomizeTest {
|
|||
Crypto.RerandomizableEncryptedMessage e = enc.encrypt(msg, enc.generateRandomness(rand));
|
||||
Crypto.RerandomizableEncryptedMessage eNew = enc.rerandomize(e, r);
|
||||
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, e).equals(msg));
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, eNew).equals(msg));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, e).equals(msg));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, eNew).equals(msg));
|
||||
|
||||
ConcreteCrypto.ElGamalCiphertext eElGamal = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext(e);
|
||||
ConcreteCrypto.ElGamalCiphertext eNewElGamal = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext(eNew);
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Random;
|
|||
/**
|
||||
* Created by Tzlil on 1/1/2016.
|
||||
*/
|
||||
public class Utiles {
|
||||
public class Utils {
|
||||
|
||||
|
||||
public final static String ENCRYPTION_KEY_ALGORITHM = "ECDH";
|
|
@ -40,7 +40,7 @@ public class ZeroKnowledgeProofTest {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
RandomOracle randomOracle = new DigestOracle();
|
||||
|
@ -53,8 +53,8 @@ public class ZeroKnowledgeProofTest {
|
|||
}
|
||||
|
||||
public void oneZKPTest() throws InvalidProtocolBufferException {
|
||||
Voting.PlaintextBallot msg1 = Utiles.genRandomBallot(2,3,16); // 2 questions with 3 answers each, in range 0-15.
|
||||
Voting.PlaintextBallot msg2 = Utiles.genRandomBallot(2,3,16);
|
||||
Voting.PlaintextBallot msg1 = Utils.genRandomBallot(2,3,16); // 2 questions with 3 answers each, in range 0-15.
|
||||
Voting.PlaintextBallot msg2 = Utils.genRandomBallot(2,3,16);
|
||||
Crypto.EncryptionRandomness r1 = enc.generateRandomness(rand);
|
||||
Crypto.EncryptionRandomness r2 = enc.generateRandomness(rand);
|
||||
|
||||
|
@ -63,10 +63,10 @@ public class ZeroKnowledgeProofTest {
|
|||
Crypto.RerandomizableEncryptedMessage e1New = enc.rerandomize(e1, r1);
|
||||
Crypto.RerandomizableEncryptedMessage e2New = enc.rerandomize(e2, r2);
|
||||
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, e1).equals(msg1));
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, e1New).equals(msg1));
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, e2).equals(msg2));
|
||||
assert (Utiles.decrypt(Voting.PlaintextBallot.class, key, group, e2New).equals(msg2));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, e1).equals(msg1));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, e1New).equals(msg1));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, e2).equals(msg2));
|
||||
assert (Utils.decrypt(Voting.PlaintextBallot.class, key, group, e2New).equals(msg2));
|
||||
|
||||
ECPoint g = group.getGenerator();
|
||||
ECPoint h = enc.getElGamalPK().getPK();
|
||||
|
|
|
@ -3,7 +3,7 @@ package profiling.BigInteger;
|
|||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class AddSub {
|
|||
ECGroup group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
ECElGamal.SK key = new ECElGamal.SK(group, sk);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utiles.serializePk(group, key);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utils.serializePk(group, key);
|
||||
ECElGamalEncryption enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package profiling.BigInteger;
|
|||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class GenerateRandomness {
|
|||
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
ECElGamal.SK key = new ECElGamal.SK(group, sk);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utiles.serializePk(group, key);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package profiling.BigInteger;
|
|||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class Modulo {
|
|||
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
ECElGamal.SK key = new ECElGamal.SK(group, sk);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utiles.serializePk(group, key);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utils.serializePk(group, key);
|
||||
ECElGamalEncryption enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
for (int i =0 ; i < tests ; i++){
|
||||
|
|
|
@ -3,7 +3,7 @@ package profiling.BigInteger;
|
|||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class Mul {
|
|||
ECGroup group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
ECElGamal.SK key = new ECElGamal.SK(group, sk);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utiles.serializePk(group, key);
|
||||
ConcreteCrypto.ElGamalPublicKey serializedPk = Utils.serializePk(group, key);
|
||||
ECElGamalEncryption enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
|||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import meerkat.protobuf.Voting;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
@ -30,7 +30,7 @@ public class ByteString2ECPoint {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
tests = 1024 * 19;
|
||||
|
@ -39,7 +39,7 @@ public class ByteString2ECPoint {
|
|||
Voting.PlaintextBallot msg;
|
||||
|
||||
for (int i = 0; i < tests; i ++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
|
||||
encryptedMessage[i] = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext
|
||||
(enc.encrypt(msg, enc.generateRandomness(rand)));
|
||||
|
|
|
@ -5,7 +5,7 @@ import meerkat.crypto.concrete.ECElGamalEncryption;
|
|||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import meerkat.protobuf.Crypto;
|
||||
import meerkat.protobuf.Voting;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class RerandomizableEncryptedMessage2ElGamalCiphertext {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
tests = 1024 * 18;
|
||||
|
@ -38,7 +38,7 @@ public class RerandomizableEncryptedMessage2ElGamalCiphertext {
|
|||
Voting.PlaintextBallot msg;
|
||||
|
||||
for (int i = 0; i < tests; i ++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
|
||||
encryptedMessage[i] = enc.encrypt(msg, enc.generateRandomness(rand));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package profiling.ECGroup;
|
|||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
@ -29,7 +29,7 @@ public class Add {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
// generate n;
|
||||
int sqrtn = 128;
|
||||
n = sqrtn*sqrtn;
|
||||
|
|
|
@ -2,7 +2,7 @@ package profiling.ECGroup;
|
|||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
@ -29,7 +29,7 @@ public class Encode {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
// generate n;
|
||||
int sqrtn = 128;
|
||||
n = sqrtn*sqrtn;
|
||||
|
|
|
@ -2,7 +2,7 @@ package profiling.ECGroup;
|
|||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
@ -30,7 +30,7 @@ public class Mul {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
// generate n
|
||||
int sqrtn = 128;
|
||||
n = sqrtn*sqrtn;
|
||||
|
|
|
@ -2,7 +2,7 @@ package profiling.ECGroup;
|
|||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import meerkat.crypto.concrete.ECElGamalEncryption;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
@ -28,7 +28,7 @@ public class Negate {
|
|||
random = new Random();
|
||||
group = new ECGroup("secp256k1");
|
||||
encryptor = new ECElGamalEncryption();
|
||||
encryptor.init(Utiles.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
encryptor.init(Utils.serializePk(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
|
||||
// generate n;
|
||||
int sqrtn = 128;
|
||||
n = sqrtn*sqrtn;
|
||||
|
|
|
@ -5,7 +5,7 @@ import meerkat.crypto.concrete.ECElGamalEncryption;
|
|||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import meerkat.protobuf.Crypto;
|
||||
import meerkat.protobuf.Voting;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
||||
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class Rerandomize {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
int LogVotes = 10;
|
||||
|
@ -43,7 +43,7 @@ public class Rerandomize {
|
|||
Voting.PlaintextBallot msg;
|
||||
|
||||
for (int i = 0; i < n ; i ++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
randomnesses[i] = enc.generateRandomness(rand);
|
||||
encryptedMessage[i] = enc.encrypt(msg, enc.generateRandomness(rand));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import meerkat.crypto.mixnet.Mix2ZeroKnowledgeProver;
|
|||
import meerkat.protobuf.ConcreteCrypto;
|
||||
import meerkat.protobuf.Crypto;
|
||||
import meerkat.protobuf.Voting;
|
||||
import mixer.Utiles;
|
||||
import mixer.Utils;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.factcenter.qilin.primitives.RandomOracle;
|
||||
import org.factcenter.qilin.primitives.concrete.DigestOracle;
|
||||
|
@ -39,7 +39,7 @@ public class ZeroKnowledgeProof {
|
|||
group = new ECGroup("secp256k1");
|
||||
BigInteger sk = ECElGamal.generateSecretKey(group, rand);
|
||||
key = new ECElGamal.SK(group, sk);
|
||||
serializedPk = Utiles.serializePk(group, key);
|
||||
serializedPk = Utils.serializePk(group, key);
|
||||
enc = new ECElGamalEncryption();
|
||||
enc.init(serializedPk);
|
||||
RandomOracle randomOracle = new DigestOracle();
|
||||
|
@ -55,7 +55,7 @@ public class ZeroKnowledgeProof {
|
|||
|
||||
|
||||
for (int i = 0; i < n*2 ; i ++){
|
||||
msg = Utiles.genRandomBallot(2,3,16);
|
||||
msg = Utils.genRandomBallot(2,3,16);
|
||||
randomnesses[i] = enc.generateRandomness(rand);
|
||||
encryptedMessage[i] = enc.encrypt(msg, enc.generateRandomness(rand));
|
||||
reencryptedMessage[i] = enc.rerandomize(encryptedMessage[i], randomnesses[i]);
|
||||
|
|
Loading…
Reference in New Issue