//package meerkat.mixer;
//
//import meerkat.crypto.concrete.ECElGamalEncryption;
//import meerkat.mixProverVerifier.proofs.Mix2nizk.Prover;
//import meerkat.mixProverVerifier.proofs.Mix2nizk.Verifier;
//import meerkat.mixProverVerifier.Mixer;
//import meerkat.mixProverVerifier.MixerOutput;
//import meerkat.mixProverVerifier.proofs.Prover;
//import meerkat.mixProverVerifier.proofs.Verifier;
//import meerkat.mixProverVerifier.VerifyTable;
//import meerkat.protobuf.Crypto;
//import meerkat.protobuf.Voting;
//import org.factcenter.qilin.primitives.RandomOracle;
//import org.factcenter.qilin.primitives.concrete.DigestOracle;
//import org.factcenter.qilin.primitives.concrete.ECElGamal;
//import org.factcenter.qilin.primitives.concrete.ECGroup;
//import org.junit.Before;
//
//import java.io.IOException;
//import java.security.spec.InvalidKeySpecException;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Random;
//
///**
// * Created by Tzlil on 1/19/2016.
// */
//public class CreateTestVector {
//
//
//    ECElGamalEncryption encryptor;
//    ECGroup group;
//    Random random,randomMixer,randomProver;
//    RandomOracle randomOracle;
//    Verifier verifier;
//    Prover prover;
//    meerkat.crypto.mixnet.Mixer mixProverVerifier;
//    private int layers;
//    private int n;
//
//
//    @Before
//    public void setup() throws InvalidKeySpecException {
//        // initialization
//        random = new Random();
//        group = new ECGroup("secp256k1");
//        encryptor = new ECElGamalEncryption();
//        encryptor.init(Utils.encodePK(group, new ECElGamal.SK(group, ECElGamal.generateSecretKey(group, random))));
//        randomMixer = new Random();
//        randomProver = new Random();
//        randomOracle = new DigestOracle();
//        verifier = new Verifier(encryptor,randomOracle);
//        prover = new Prover(randomProver,encryptor,randomOracle);
//        mixProverVerifier = new Mixer(prover,encryptor);
//
//        // generate n
//        int logN = 10; //  + random.nextInt(8)
//        layers = 2*logN - 1;
//        n = 1 << logN;
//    }
//
//    public List<Crypto.RerandomizableEncryptedMessage> generateMixerInput(){
//        List<Crypto.RerandomizableEncryptedMessage> result = new ArrayList<Crypto.RerandomizableEncryptedMessage>();
//        Voting.PlaintextBallot msg;
//        for (int i = 0; i < n ; i++){
//            msg = Utils.genRandomBallot(2,3,16);
//            result.add(encryptor.encrypt(msg, encryptor.generateRandomness(random)));
//        }
//        return result;
//    }
//    //@SimpleRerandomizeTest
//    public void createValidTest() throws IOException {
//
//        List<Crypto.RerandomizableEncryptedMessage> mixerInput = generateMixerInput();
//        System.out.println("start network");
//        MixerOutput mixerOutput = (MixerOutput)mixProverVerifier.mix(mixerInput,randomMixer);
//        System.out.println("network ended, start verification");
//        assert (VerifyTable.verifyTable(verifier,n,mixerOutput));
//        System.out.println("verification ended, start printing");
//        mixerOutput.outToFolder("C:\\Users\\Tzlil\\Desktop\\TestVector\\Test3");
//        System.out.println("all done");
//    }
//
//    //@SimpleRerandomizeTest
//    public void createInvalidTest() throws IOException {
//
//        //Verifier corruptedVerifier = new Verifier(enc,randomOracle,true);
//        //Prover corruptedProver = new Prover(randomProver,enc,randomOracle,true);
//        //mixProverVerifier = new Mixer(randomMixer,corruptedProver,enc,corruptedVerifier);
//
//        List<Crypto.RerandomizableEncryptedMessage> mixerInput = generateMixerInput();
//        System.out.println("start network");
//        MixerOutput mixerOutput = (MixerOutput)mixProverVerifier.mix(mixerInput,random);
//        System.out.println("network ended, start negative verification");
//        assert (!VerifyTable.verifyTable(verifier,n,mixerOutput));
//        System.out.println("verification ended, start printing");
//        mixerOutput.outToFolder("C:\\Users\\Tzlil\\Desktop\\TestVector\\Test5");
//        System.out.println("all done");
//    }
//}
