test_class.declarator: curve = CommonConfiguration.CURVE
test_class.modifier: final public static
test_class.original_string: final public static EcCurve curve = CommonConfiguration.CURVE;
test_class.type: EcCurve
test_class.var_name: curve
test_class.declarator: r = curve.getR()
test_class.modifier: final public static
test_class.original_string: final public static BigInteger r = curve.getR();
test_class.type: BigInteger
test_class.var_name: r
test_class.declarator: G = curve.getG()
test_class.modifier: final public static
test_class.original_string: final public static EcPoint G = curve.getG();
test_class.type: EcPoint
test_class.var_name: G
test_class.file: pross-common/src/test/java/com/ibm/pross/common/util/shamir/ShamirTest.java
test_class.identifier: ShamirTest
test_case.body: @Test
  	public void testGenerateShares() {
  
  		int n = 9;
  		int threshold = 5;
  
  		// Create coefficients
  		final BigInteger[] coefficients = Shamir.generateCoefficients(threshold);
  
  		final BigInteger secret = RandomNumberGenerator.generateRandomInteger(r);
  		coefficients[0] = secret;
  
  		// Create shares
  		final ShamirShare[] shares = Shamir.generateShares(coefficients, n);
  		final Set<ShamirShare> shareSet = new HashSet<>(Arrays.asList(shares));
  
  		// Interpolate at different points, secret matches for position 0 only
  		for (int i = 0; i <= n; i++) {
  			if (i == 0) {
  				final BigInteger result = Polynomials.interpolateComplete(shareSet, threshold, i);
  				Assert.assertEquals(secret, result);
  			} else {
  				final BigInteger result = Polynomials.interpolateComplete(shareSet, threshold, i);
  				Assert.assertNotEquals(secret, result);
  			}
  		}
  	}
test_case.class_method_signature: ShamirTest.testGenerateShares()
test_case.full_signature: @Test public void testGenerateShares()
test_case.identifier: testGenerateShares
test_case.invocations: generateCoefficients generateRandomInteger generateShares asList interpolateComplete assertEquals interpolateComplete assertNotEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateShares()
focal_class.declarator: curve = CommonConfiguration.CURVE
focal_class.modifier: final public static
focal_class.original_string: final public static EcCurve curve = CommonConfiguration.CURVE;
focal_class.type: EcCurve
focal_class.var_name: curve
focal_class.declarator: r = curve.getR()
focal_class.modifier: final public static
focal_class.original_string: final public static BigInteger r = curve.getR();
focal_class.type: BigInteger
focal_class.var_name: r
focal_class.declarator: G = curve.getG()
focal_class.modifier: final public static
focal_class.original_string: final public static EcPoint G = curve.getG();
focal_class.type: EcPoint
focal_class.var_name: G
focal_class.file: pross-common/src/main/java/com/ibm/pross/common/util/shamir/Shamir.java
focal_class.identifier: Shamir
focal_class.class_method_signature: Shamir.generateCoefficients(final int threshold)
focal_class.full_signature: public static BigInteger[] generateCoefficients(final int threshold)
focal_class.identifier: generateCoefficients
focal_class.modifiers: public static
focal_class.parameters: (final int threshold)
focal_class.return: BigInteger[]
focal_class.signature: BigInteger[] generateCoefficients(final int threshold)
focal_class.class_method_signature: Shamir.generateCoefficients(final int threshold, final int indexOfZero)
focal_class.full_signature: public static BigInteger[] generateCoefficients(final int threshold, final int indexOfZero)
focal_class.identifier: generateCoefficients
focal_class.modifiers: public static
focal_class.parameters: (final int threshold, final int indexOfZero)
focal_class.return: BigInteger[]
focal_class.signature: BigInteger[] generateCoefficients(final int threshold, final int indexOfZero)
focal_class.class_method_signature: Shamir.generateFeldmanValues(final BigInteger[] coefficients)
focal_class.full_signature: public static EcPoint[] generateFeldmanValues(final BigInteger[] coefficients)
focal_class.identifier: generateFeldmanValues
focal_class.modifiers: public static
focal_class.parameters: (final BigInteger[] coefficients)
focal_class.return: EcPoint[]
focal_class.signature: EcPoint[] generateFeldmanValues(final BigInteger[] coefficients)
focal_class.class_method_signature: Shamir.generateFeldmanValues(final BigInteger[] coefficients, final EcPoint base)
focal_class.full_signature: public static EcPoint[] generateFeldmanValues(final BigInteger[] coefficients, final EcPoint base)
focal_class.identifier: generateFeldmanValues
focal_class.modifiers: public static
focal_class.parameters: (final BigInteger[] coefficients, final EcPoint base)
focal_class.return: EcPoint[]
focal_class.signature: EcPoint[] generateFeldmanValues(final BigInteger[] coefficients, final EcPoint base)
focal_class.class_method_signature: Shamir.generateShares(final BigInteger[] coefficients, final int n)
focal_class.full_signature: public static ShamirShare[] generateShares(final BigInteger[] coefficients, final int n)
focal_class.identifier: generateShares
focal_class.modifiers: public static
focal_class.parameters: (final BigInteger[] coefficients, final int n)
focal_class.return: ShamirShare[]
focal_class.signature: ShamirShare[] generateShares(final BigInteger[] coefficients, final int n)
focal_class.class_method_signature: Shamir.verifyShamirShareConsistency(final ShamirShare share, final EcPoint[] feldmanValues)
focal_class.full_signature: public static void verifyShamirShareConsistency(final ShamirShare share, final EcPoint[] feldmanValues)
focal_class.identifier: verifyShamirShareConsistency
focal_class.modifiers: public static
focal_class.parameters: (final ShamirShare share, final EcPoint[] feldmanValues)
focal_class.return: void
focal_class.signature: void verifyShamirShareConsistency(final ShamirShare share, final EcPoint[] feldmanValues)
focal_class.class_method_signature: Shamir.computeSharePublicKeys(final EcPoint[] feldmanValues, final int n)
focal_class.full_signature: public static EcPoint[] computeSharePublicKeys(final EcPoint[] feldmanValues, final int n)
focal_class.identifier: computeSharePublicKeys
focal_class.modifiers: public static
focal_class.parameters: (final EcPoint[] feldmanValues, final int n)
focal_class.return: EcPoint[]
focal_class.signature: EcPoint[] computeSharePublicKeys(final EcPoint[] feldmanValues, final int n)
focal_class.class_method_signature: Shamir.computeSharePublicKey(final EcPoint[] feldmanValues, final int xPosition)
focal_class.full_signature: public static EcPoint computeSharePublicKey(final EcPoint[] feldmanValues, final int xPosition)
focal_class.identifier: computeSharePublicKey
focal_class.modifiers: public static
focal_class.parameters: (final EcPoint[] feldmanValues, final int xPosition)
focal_class.return: EcPoint
focal_class.signature: EcPoint computeSharePublicKey(final EcPoint[] feldmanValues, final int xPosition)
focal_method.body: public static ShamirShare[] generateShares(final BigInteger[] coefficients, final int n) {
  
  		// Evaluate the polynomial from 1 to n (must not evaluate at zero!)
  		ShamirShare[] shares = new ShamirShare[n];
  		for (int i = 0; i < n; i++) {
  			final BigInteger xCoord = BigInteger.valueOf(i + 1);
  			shares[i] = Polynomials.evaluatePolynomial(coefficients, xCoord, r);
  		}
  
  		return shares;
  	}
focal_method.class_method_signature: Shamir.generateShares(final BigInteger[] coefficients, final int n)
focal_method.full_signature: public static ShamirShare[] generateShares(final BigInteger[] coefficients, final int n)
focal_method.identifier: generateShares
focal_method.invocations: valueOf evaluatePolynomial
focal_method.modifiers: public static
focal_method.parameters: (final BigInteger[] coefficients, final int n)
focal_method.return: ShamirShare[]
focal_method.signature: ShamirShare[] generateShares(final BigInteger[] coefficients, final int n)