test_class.file: pross-common/src/test/java/com/ibm/pross/common/util/crypto/zkp/splitting/ZeroKnowledgeProverTest.java
test_class.identifier: ZeroKnowledgeProverTest
test_case.body: @Test
  	public void testProofPerformance() {
  		
  		final EcCurve curve = CommonConfiguration.CURVE;
  
  		final BigInteger a0 = RandomNumberGenerator.generateRandomInteger(curve.getR());
  		final BigInteger b0 = RandomNumberGenerator.generateRandomInteger(curve.getR());
  		
  		
  		// Warm up
  		ZeroKnowledgeProof zkp = null;
  		for (int i = 0; i < 20; i++)
  		{
  			zkp = ZeroKnowledgeProver.createProof(a0, b0);
  		}
  		
  		int length = (zkp.getA0().getX().toByteArray().length + 1) + (zkp.getB0().getX().toByteArray().length + 1) + zkp.getC().toByteArray().length + zkp.getSa().toByteArray().length + zkp.getSb().toByteArray().length;
  		System.out.println("size: " + length);
  		
  		// Do test
  		long timeNs = 0;
  		final int iterations = 1000;
  		for (int i = 0; i < iterations; i++)
  		{
  			final BigInteger a = RandomNumberGenerator.generateRandomInteger(curve.getR());
  			final BigInteger b = RandomNumberGenerator.generateRandomInteger(curve.getR());
  			final long start = System.nanoTime();
  			ZeroKnowledgeProver.createProof(a, b);
  			final long end = System.nanoTime();
  			timeNs += (end - start);
  		}
  		
  		System.out.println("Total time (ms): " + timeNs / (((long)iterations) * 1_000_000.0));
  	}
test_case.class_method_signature: ZeroKnowledgeProverTest.testProofPerformance()
test_case.full_signature: @Test public void testProofPerformance()
test_case.identifier: testProofPerformance
test_case.invocations: generateRandomInteger getR generateRandomInteger getR createProof toByteArray getX getA0 toByteArray getX getB0 toByteArray getC toByteArray getSa toByteArray getSb println generateRandomInteger getR generateRandomInteger getR nanoTime createProof nanoTime println
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testProofPerformance()
focal_class.declarator: curve = CommonConfiguration.CURVE
focal_class.modifier: public static final
focal_class.original_string: public static final EcCurve curve = CommonConfiguration.CURVE;
focal_class.type: EcCurve
focal_class.var_name: curve
focal_class.declarator: g = CommonConfiguration.g
focal_class.modifier: public static final
focal_class.original_string: public static final EcPoint g = CommonConfiguration.g;
focal_class.type: EcPoint
focal_class.var_name: g
focal_class.declarator: h = CommonConfiguration.h
focal_class.modifier: public static final
focal_class.original_string: public static final EcPoint h = CommonConfiguration.h;
focal_class.type: EcPoint
focal_class.var_name: h
focal_class.declarator: HASH_ALGORITHM = CommonConfiguration.HASH_ALGORITHM
focal_class.modifier: public static final
focal_class.original_string: public static final String HASH_ALGORITHM = CommonConfiguration.HASH_ALGORITHM;
focal_class.type: String
focal_class.var_name: HASH_ALGORITHM
focal_class.file: pross-common/src/main/java/com/ibm/pross/common/util/crypto/zkp/splitting/ZeroKnowledgeProver.java
focal_class.identifier: ZeroKnowledgeProver
focal_class.class_method_signature: ZeroKnowledgeProver.createProof(final BigInteger a0, final BigInteger b0)
focal_class.full_signature: public static ZeroKnowledgeProof createProof(final BigInteger a0, final BigInteger b0)
focal_class.identifier: createProof
focal_class.modifiers: public static
focal_class.parameters: (final BigInteger a0, final BigInteger b0)
focal_class.return: ZeroKnowledgeProof
focal_class.signature: ZeroKnowledgeProof createProof(final BigInteger a0, final BigInteger b0)
focal_class.class_method_signature: ZeroKnowledgeProver.verifyProof(final EcPoint C0, final ZeroKnowledgeProof proof)
focal_class.full_signature: public static boolean verifyProof(final EcPoint C0, final ZeroKnowledgeProof proof)
focal_class.identifier: verifyProof
focal_class.modifiers: public static
focal_class.parameters: (final EcPoint C0, final ZeroKnowledgeProof proof)
focal_class.return: boolean
focal_class.signature: boolean verifyProof(final EcPoint C0, final ZeroKnowledgeProof proof)
focal_method.body: public static ZeroKnowledgeProof createProof(final BigInteger a0, final BigInteger b0)
  	{
  		// Calculate A0 and B0
  		final EcPoint A0 = curve.multiply(g, a0);
  		final EcPoint B0 = curve.multiply(h, b0);
  		
  		// Chose random points
  		final BigInteger r1 = RandomNumberGenerator.generateRandomInteger(curve.getR());
  		final BigInteger r2 = RandomNumberGenerator.generateRandomInteger(curve.getR());
  		
  		// Compute powers
  		final EcPoint p1 = curve.multiply(g, r1);
  		final EcPoint p2 = curve.multiply(h, r2);
  		final EcPoint sum = curve.addPoints(p1, p2);
  		
  		// Compute c
  		final byte[] input = Parse.concatenate(g, h, sum);
  		final MessageDigest digest;
  		try {
  			digest = MessageDigest.getInstance(HASH_ALGORITHM);
  		} catch (NoSuchAlgorithmException e) {
  			throw new RuntimeException("Should not happen");
  		}
  		final BigInteger c = new BigInteger(1, digest.digest(input)).mod(curve.getR());
  		
  		// Compute sa and sb
  		final BigInteger sa = (r1.subtract(c.multiply(a0))).mod(curve.getR());
  		final BigInteger sb = (r2.subtract(c.multiply(b0))).mod(curve.getR());
  		
  		return new ZeroKnowledgeProof(A0, B0, c, sa, sb);
  	}
focal_method.class_method_signature: ZeroKnowledgeProver.createProof(final BigInteger a0, final BigInteger b0)
focal_method.full_signature: public static ZeroKnowledgeProof createProof(final BigInteger a0, final BigInteger b0)
focal_method.identifier: createProof
focal_method.invocations: multiply multiply generateRandomInteger getR generateRandomInteger getR multiply multiply addPoints concatenate getInstance mod digest getR mod subtract multiply getR mod subtract multiply getR
focal_method.modifiers: public static
focal_method.parameters: (final BigInteger a0, final BigInteger b0)
focal_method.return: ZeroKnowledgeProof
focal_method.signature: ZeroKnowledgeProof createProof(final BigInteger a0, final BigInteger b0)