From 1913ecde1fc3d60dbefabc5f6d745ba9d603d3b7 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 13 Nov 2015 13:33:44 +0700 Subject: Further refinement to random prime constructor --- crypto/src/math/BigInteger.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crypto/src/math/BigInteger.cs') diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs index 794f252e8..b35701fb3 100644 --- a/crypto/src/math/BigInteger.cs +++ b/crypto/src/math/BigInteger.cs @@ -706,10 +706,9 @@ namespace Org.BouncyCastle.Math if (CheckProbablePrime(certainty, random, true)) break; - for (int j = 1; j < magnitude.Length; ++j) + for (int j = 1; j < (magnitude.Length - 1); ++j) { - this.magnitude[j] ^= (random.Next() << 1); - this.mQuote = 0; + this.magnitude[j] ^= random.Next(); if (CheckProbablePrime(certainty, random, true)) return; -- cgit 1.4.1