generatePrivateValue static method
Implementation
static BigInt? generatePrivateValue(
Digest digest, BigInt N, BigInt g, SecureRandom random) {
var minBits = math.min(256, N.bitLength ~/ 2);
var min = BigInt.one << (minBits - 1);
var max = N - BigInt.one;
BigInt result;
do {
result = random.nextBigInteger(minBits);
} while (result > max || result < min);
return result;
}