Search in sources :

Example 46 with BigInteger

use of java.math.BigInteger in project wycheproof by google.

the class DhTest method openJdk1024.

// The default parameters returned for 1024 bit DH keys from OpenJdk as defined in
// openjdk7/releases/v6/trunk/jdk/src/share/classes/sun/security/provider/ParameterCache.java
// I.e., these are the same parameters as used for DSA.
public DHParameterSpec openJdk1024() {
    final BigInteger p = new BigInteger("fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669" + "455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b7" + "6b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb" + "83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7", 16);
    final BigInteger unusedQ = new BigInteger("9760508f15230bccb292b982a2eb840bf0581cf5", 16);
    final BigInteger g = new BigInteger("f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d078267" + "5159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e1" + "3c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243b" + "cca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a", 16);
    return new DHParameterSpec(p, g);
}
Also used : BigInteger(java.math.BigInteger) DHParameterSpec(javax.crypto.spec.DHParameterSpec)

Example 47 with BigInteger

use of java.math.BigInteger in project hazelcast by hazelcast.

the class MultiMapMaxAggregationTest method testBigIntegerMaxWithExtractor.

@Test
public void testBigIntegerMaxWithExtractor() throws Exception {
    Value<BigInteger>[] values = buildValues(new ValueProvider<BigInteger>() {

        @Override
        public BigInteger provideRandom(Random random) {
            return BigInteger.valueOf(10000L + random(1000, 2000));
        }
    });
    BigInteger expectation = BigInteger.ZERO;
    for (int i = 0; i < values.length; i++) {
        Value<BigInteger> value = values[i];
        expectation = i == 0 ? value.value : expectation.max(value.value);
    }
    Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerMax();
    BigInteger result = testMaxWithExtractor(values, aggregation);
    assertEquals(expectation, result);
}
Also used : Random(java.util.Random) BigInteger(java.math.BigInteger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 48 with BigInteger

use of java.math.BigInteger in project hazelcast by hazelcast.

the class MultiMapMinAggregationTest method testBigIntegerMin.

@Test
public void testBigIntegerMin() throws Exception {
    BigInteger[] values = buildPlainValues(new ValueProvider<BigInteger>() {

        @Override
        public BigInteger provideRandom(Random random) {
            return BigInteger.valueOf(10000L + random(1000, 2000));
        }
    }, BigInteger.class);
    BigInteger expectation = BigInteger.ZERO;
    for (int i = 0; i < values.length; i++) {
        BigInteger value = values[i];
        expectation = i == 0 ? value : expectation.min(value);
    }
    Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerMin();
    BigInteger result = testMin(values, aggregation);
    assertEquals(expectation, result);
}
Also used : Random(java.util.Random) BigInteger(java.math.BigInteger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 49 with BigInteger

use of java.math.BigInteger in project hazelcast by hazelcast.

the class MultiMapSumAggregationTest method testBigIntegerSum.

@Test
public void testBigIntegerSum() throws Exception {
    BigInteger[] values = buildPlainValues(new ValueProvider<BigInteger>() {

        @Override
        public BigInteger provideRandom(Random random) {
            return BigInteger.valueOf(10000L + random(1000, 2000));
        }
    }, BigInteger.class);
    BigInteger expectation = BigInteger.ZERO;
    for (int i = 0; i < values.length; i++) {
        expectation = expectation.add(values[i]);
    }
    Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerSum();
    BigInteger result = testSum(values, aggregation);
    assertEquals(expectation, result);
}
Also used : Random(java.util.Random) BigInteger(java.math.BigInteger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 50 with BigInteger

use of java.math.BigInteger in project hazelcast by hazelcast.

the class MapMinAggregationTest method testBigIntegerMin.

@Test
public void testBigIntegerMin() throws Exception {
    BigInteger[] values = buildPlainValues(new ValueProvider<BigInteger>() {

        @Override
        public BigInteger provideRandom(Random random) {
            return BigInteger.valueOf(10000L + random(1000, 2000));
        }
    }, BigInteger.class);
    BigInteger expectation = BigInteger.ZERO;
    for (int i = 0; i < values.length; i++) {
        BigInteger value = values[i];
        expectation = i == 0 ? value : expectation.min(value);
    }
    Aggregation<String, BigInteger, BigInteger> aggregation = Aggregations.bigIntegerMin();
    BigInteger result = testMin(values, aggregation);
    assertEquals(expectation, result);
}
Also used : Random(java.util.Random) BigInteger(java.math.BigInteger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

BigInteger (java.math.BigInteger)3500 BigDecimal (java.math.BigDecimal)635 Test (org.junit.Test)337 IOException (java.io.IOException)113 ArrayList (java.util.ArrayList)105 MessageDigest (java.security.MessageDigest)101 RoundingMode (java.math.RoundingMode)88 Date (java.util.Date)80 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)75 MathContext (java.math.MathContext)71 Random (java.util.Random)65 Test (org.junit.jupiter.api.Test)50 QuickTest (com.hazelcast.test.annotation.QuickTest)47 ParallelTest (com.hazelcast.test.annotation.ParallelTest)46 KeyFactory (java.security.KeyFactory)46 HashMap (java.util.HashMap)45 List (java.util.List)44 SecureRandom (java.security.SecureRandom)42 X509Certificate (java.security.cert.X509Certificate)42 EllipticCurve (java.security.spec.EllipticCurve)40