Пример #1
0
        public static BInteger genPseudoPrime(int bits, int confidence, Random rand)
        {
            BInteger result = new BInteger();
            bool done = false;

            while (!done)
            {
                result.genRandomBits(bits, rand);
                result.data[0] |= 0x01;     // make it odd

                // prime test
                done = result.isProbablePrime(confidence);
            }
            return result;
        }