randomPrimeBigInt function
used to generate random prime integer to generate ZotPublicKey and ZotPrivateKey
Implementation
BigInt randomPrimeBigInt(int bits, {Random? random}) {
random ??= Random.secure();
while (true) {
var next = randomBigInt(bits, random: random);
if (next.isEven) next = next | BigInt.one;
while (next.bitLength == bits) {
if (next.isPrime()) {
return next;
}
next += BigInt.two;
}
}
}