// Path: src/main/java/edu/stanford/crypto/ECConstants.java
// public final class ECConstants {
//     static {
//         SecP256K1Curve curve = new SecP256K1Curve();
//         BigInteger hash = BigInteger.ZERO;
//         try {
//             MessageDigest sha256 = sha256 = MessageDigest.getInstance("SHA-256");
//             sha256.update("PROVISIONS".getBytes());
//             hash = new BigInteger(sha256.digest());
// 
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         }
//         ECFieldElement x = new SecP256K1FieldElement(hash.mod(curve.getQ()));
//         ECFieldElement rhs = x.square().multiply(x.add(curve.getA())).add(curve.getB());
//         ECFieldElement y = rhs.sqrt();
// 
// 
//         H = curve.validatePoint(x.toBigInteger(), y.toBigInteger());
// 
// 
//     }
// 
//     public static final ECCurve BITCOIN_CURVE = new SecP256K1Curve();
//     public static final ECPoint INFINITY = BITCOIN_CURVE.getInfinity();
//     public static final int STANDARD_SECURITY = 256;
//     public static final int CHALLENGE_LENGTH = 256;
//     public static final ECPoint G = CustomNamedCurves.getByName("secp256k1").getG();
//     public static final ECPoint H;
//     public static final BigInteger Q = BITCOIN_CURVE.getOrder();
//     public static final BigInteger CHALLENGE_Q = Q.min(BigInteger.ONE.shiftLeft(256));
// 
//     private ECConstants() {
//     }
// }
// 
// Path: src/main/java/edu/stanford/crypto/verification/AddressProofVerifier.java
// public class AddressProofVerifier
//         implements Verifier<AddressProof, AddressVerificationData> {
//     @Override
//     public void verify(AddressProof proof, AddressVerificationData data) {
//         ECPoint g = data.getG();
//         ECPoint h = data.getH();
//         ECPoint b = g.multiply(data.getBalance());
//         BigInteger transmittedChallenge = proof.getChallengeZero().add(proof.getChallengeOne());
//         ECPoint balanceClaim = proof.getCommitmentBalance().multiply(transmittedChallenge);
//         ECPoint a1 = h.multiply(proof.getResponseV()).add(b.multiply(proof.getResponseS())).subtract(balanceClaim);
//         ECPoint xHatClaim = proof.getCommitmentXHat().multiply(transmittedChallenge);
//         ECPoint a2 = data.getPublicKey().multiply(proof.getResponseS()).add(h.multiply(proof.getResponseT())).subtract(xHatClaim);
//         ECPoint a3 = g.multiply(proof.getResponseXHat()).add(h.multiply(proof.getResponseT())).subtract(xHatClaim);
//         ECPoint zeroClaim = proof.getCommitmentBalance().multiply(proof.getChallengeZero());
//         ECPoint oneClaim = proof.getCommitmentBalance().subtract(b).multiply(proof.getChallengeOne());
// 
//         ECPoint aZero = h.multiply(proof.getResponseZero()).subtract(zeroClaim);
//         ECPoint aOne = h.multiply(proof.getResponseOne()).subtract(oneClaim);
// 
//         BigInteger computedChallenge = ProofUtils.computeChallenge(g, h, data.getPublicKey(), b, proof.getCommitmentBalance(), proof.getCommitmentXHat(), a1, a2, a3, aZero, aOne);
//         this.holds(transmittedChallenge, computedChallenge);
//     }
// }
// 
// Path: src/main/java/edu/stanford/crypto/verification/AddressVerificationData.java
// public class AddressVerificationData
//         implements VerificationData<AddressProof> {
//     private final ECPoint publicKey;
//     private final BigInteger balance;
//     private final ECPoint g;
//     private final ECPoint h;
// 
//     public AddressVerificationData(ECPoint publicKey, BigInteger balance, ECPoint g, ECPoint h) {
//         this.publicKey = publicKey;
//         this.balance = balance;
//         this.g = g;
//         this.h = h;
//     }
// 
//     public ECPoint getPublicKey() {
//         return this.publicKey;
//     }
// 
//     public BigInteger getBalance() {
//         return this.balance;
//     }
// 
//     public ECPoint getG() {
//         return this.g;
//     }
// 
//     public ECPoint getH() {
//         return this.h;
//     }
// }


import edu.stanford.crypto.ECConstants;
import edu.stanford.crypto.verification.AddressProofVerifier;
import edu.stanford.crypto.verification.AddressVerificationData;
import org.bouncycastle.math.ec.ECPoint;
import org.junit.Test;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;
package edu.stanford.crypto.proof.assets;



/**
 * Created by buenz on 06.01.16.
 */
public class AddressProofTest {
    @Test
    public void testAddressProofWithKey() {
        AddressProofSystem system = new AddressProofSystem();
// Path: src/main/java/edu/stanford/crypto/ECConstants.java
// public final class ECConstants {
//     static {
//         SecP256K1Curve curve = new SecP256K1Curve();
//         BigInteger hash = BigInteger.ZERO;
//         try {
//             MessageDigest sha256 = sha256 = MessageDigest.getInstance("SHA-256");
//             sha256.update("PROVISIONS".getBytes());
//             hash = new BigInteger(sha256.digest());
// 
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         }
//         ECFieldElement x = new SecP256K1FieldElement(hash.mod(curve.getQ()));
//         ECFieldElement rhs = x.square().multiply(x.add(curve.getA())).add(curve.getB());
//         ECFieldElement y = rhs.sqrt();
// 
// 
//         H = curve.validatePoint(x.toBigInteger(), y.toBigInteger());
// 
// 
//     }
// 
//     public static final ECCurve BITCOIN_CURVE = new SecP256K1Curve();
//     public static final ECPoint INFINITY = BITCOIN_CURVE.getInfinity();
//     public static final int STANDARD_SECURITY = 256;
//     public static final int CHALLENGE_LENGTH = 256;
//     public static final ECPoint G = CustomNamedCurves.getByName("secp256k1").getG();
//     public static final ECPoint H;
//     public static final BigInteger Q = BITCOIN_CURVE.getOrder();
//     public static final BigInteger CHALLENGE_Q = Q.min(BigInteger.ONE.shiftLeft(256));
// 
//     private ECConstants() {
//     }
// }
// 
// Path: src/main/java/edu/stanford/crypto/verification/AddressProofVerifier.java
// public class AddressProofVerifier
//         implements Verifier<AddressProof, AddressVerificationData> {
//     @Override
//     public void verify(AddressProof proof, AddressVerificationData data) {
//         ECPoint g = data.getG();
//         ECPoint h = data.getH();
//         ECPoint b = g.multiply(data.getBalance());
//         BigInteger transmittedChallenge = proof.getChallengeZero().add(proof.getChallengeOne());
//         ECPoint balanceClaim = proof.getCommitmentBalance().multiply(transmittedChallenge);
//         ECPoint a1 = h.multiply(proof.getResponseV()).add(b.multiply(proof.getResponseS())).subtract(balanceClaim);
//         ECPoint xHatClaim = proof.getCommitmentXHat().multiply(transmittedChallenge);
//         ECPoint a2 = data.getPublicKey().multiply(proof.getResponseS()).add(h.multiply(proof.getResponseT())).subtract(xHatClaim);
//         ECPoint a3 = g.multiply(proof.getResponseXHat()).add(h.multiply(proof.getResponseT())).subtract(xHatClaim);
//         ECPoint zeroClaim = proof.getCommitmentBalance().multiply(proof.getChallengeZero());
//         ECPoint oneClaim = proof.getCommitmentBalance().subtract(b).multiply(proof.getChallengeOne());
// 
//         ECPoint aZero = h.multiply(proof.getResponseZero()).subtract(zeroClaim);
//         ECPoint aOne = h.multiply(proof.getResponseOne()).subtract(oneClaim);
// 
//         BigInteger computedChallenge = ProofUtils.computeChallenge(g, h, data.getPublicKey(), b, proof.getCommitmentBalance(), proof.getCommitmentXHat(), a1, a2, a3, aZero, aOne);
//         this.holds(transmittedChallenge, computedChallenge);
//     }
// }
// 
// Path: src/main/java/edu/stanford/crypto/verification/AddressVerificationData.java
// public class AddressVerificationData
//         implements VerificationData<AddressProof> {
//     private final ECPoint publicKey;
//     private final BigInteger balance;
//     private final ECPoint g;
//     private final ECPoint h;
// 
//     public AddressVerificationData(ECPoint publicKey, BigInteger balance, ECPoint g, ECPoint h) {
//         this.publicKey = publicKey;
//         this.balance = balance;
//         this.g = g;
//         this.h = h;
//     }
// 
//     public ECPoint getPublicKey() {
//         return this.publicKey;
//     }
// 
//     public BigInteger getBalance() {
//         return this.balance;
//     }
// 
//     public ECPoint getG() {
//         return this.g;
//     }
// 
//     public ECPoint getH() {
//         return this.h;
//     }
// }


// Path: src/test/java/edu/stanford/crypto/proof/assets/AddressProofTest.java
import edu.stanford.crypto.ECConstants;
import edu.stanford.crypto.verification.AddressProofVerifier;
import edu.stanford.crypto.verification.AddressVerificationData;
import org.bouncycastle.math.ec.ECPoint;
import org.junit.Test;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

package edu.stanford.crypto.proof.assets;



/**
 * Created by buenz on 06.01.16.
 */
public class AddressProofTest {
    @Test
    public void testAddressProofWithKey() {
        AddressProofSystem system = new AddressProofSystem();
        Random rng = new SecureRandom();