diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-23 17:36:05 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-23 17:36:05 +0700 |
commit | 6523b613d4a657b02da0777083116a2f5df55e98 (patch) | |
tree | cc49fe502a5d73648cad86b3ca2dfce73a8b9d28 /crypto/src/math/BigInteger.cs | |
parent | Change BigInteger arbitrary random source (diff) | |
download | BouncyCastle.NET-ed25519-6523b613d4a657b02da0777083116a2f5df55e98.tar.xz |
Complete SecureRandom refactoring
Diffstat (limited to 'crypto/src/math/BigInteger.cs')
-rw-r--r-- | crypto/src/math/BigInteger.cs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs index 5986f9fd8..caf78843e 100644 --- a/crypto/src/math/BigInteger.cs +++ b/crypto/src/math/BigInteger.cs @@ -163,8 +163,6 @@ namespace Org.BouncyCastle.Math private const int chunk2 = 1, chunk8 = 1, chunk10 = 19, chunk16 = 16; private static readonly BigInteger radix2, radix2E, radix8, radix8E, radix10, radix10E, radix16, radix16E; - private static readonly SecureRandom RandomSource = new SecureRandom(new VmpcRandomGenerator(), 16); - /* * These are the threshold bit-lengths (of an exponent) where we increase the window size. * They are calculated according to the expected savings in multiplications. @@ -244,7 +242,7 @@ namespace Org.BouncyCastle.Math public static BigInteger Arbitrary(int sizeInBits) { - return new BigInteger(sizeInBits, RandomSource); + return new BigInteger(sizeInBits, SecureRandom.ArbitraryRandom); } private BigInteger( @@ -1460,7 +1458,7 @@ namespace Org.BouncyCastle.Math if (n.Equals(One)) return false; - return n.CheckProbablePrime(certainty, RandomSource, randomlySelected); + return n.CheckProbablePrime(certainty, SecureRandom.ArbitraryRandom, randomlySelected); } private bool CheckProbablePrime(int certainty, Random random, bool randomlySelected) @@ -2633,7 +2631,7 @@ namespace Org.BouncyCastle.Math BigInteger n = Inc().SetBit(0); - while (!n.CheckProbablePrime(100, RandomSource, false)) + while (!n.CheckProbablePrime(100, SecureRandom.ArbitraryRandom, false)) { n = n.Add(Two); } |