mirrored from https://www.bouncycastle.org/repositories/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refinement on GCD sieve, added bounds test
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
core/src/test/java/org/bouncycastle/crypto/test/BigIntegersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.bouncycastle.crypto.test; | ||
|
||
import java.math.BigInteger; | ||
|
||
import org.bouncycastle.util.BigIntegers; | ||
import org.bouncycastle.util.test.SimpleTest; | ||
import org.bouncycastle.util.test.TestRandomData; | ||
|
||
public class BigIntegersTest | ||
extends SimpleTest | ||
{ | ||
public String getName() | ||
{ | ||
return "BigIntegers"; | ||
} | ||
|
||
public void performTest() | ||
throws Exception | ||
{ | ||
BigInteger min = BigInteger.valueOf(5); | ||
isTrue(min.equals(BigIntegers.createRandomPrime(min.bitLength(), 1, | ||
new TestRandomData(BigIntegers.asUnsignedByteArray(min))))); | ||
|
||
BigInteger max = BigInteger.valueOf(743); | ||
isTrue(max.equals(BigIntegers.createRandomPrime(max.bitLength(), 1, | ||
new TestRandomData(BigIntegers.asUnsignedByteArray(max))))); | ||
} | ||
|
||
public static void main(String[] args) | ||
throws Exception | ||
{ | ||
runTest(new BigIntegersTest()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters