private void GenerateByLenght(int bitLenght, int certainty)
        {
            BigInteger output = RabinMiler.GeneratePrimeNumberbyLenght(bitLenght, certainty);

            Console.WriteLine("Ilość bitów: " + bitLenght);
            Console.WriteLine("Ilość znaków: " + output.ToString().Length);
            Console.WriteLine(output);
        }
Beispiel #2
0
 public static void BasicGeneratePrimeNumber(uint begin, uint end)
 {
     for (uint i = begin; i < end; i++)
     {
         if (RabinMiler.CheckIfPrimeNumberBignumbers(i, 2))
         {
             Console.WriteLine(i.ToString() + " ");
         }
     }
 }
 private void RealyBigCheck(BigInteger input, int certainty)
 {
     if (RabinMiler.CheckIfPrimeNumberBignumbers(input, certainty))
     {
         Console.WriteLine("To jest liczba pierwsza");
     }
     else
     {
         Console.WriteLine("To nie jest liczba pierwsza");
     }
 }
Beispiel #4
0
        public static void GeneratePrimeNumber(string begin, string end)
        {
            var beginNumber = BigInteger.Parse(begin);
            var endNumber   = BigInteger.Parse(end);

            for (var i = beginNumber; i < endNumber; i++)
            {
                if (RabinMiler.CheckIfPrimeNumberBignumbers(i, 2))
                {
                    Console.WriteLine(i.ToString() + " ");
                }
            }
        }
Beispiel #5
0
        public static BigInteger GeneratePrimeNumberbyLenght(int primeLenght, int certainty)
        {
            BigInteger primeNumber = BigInteger.One;
            BigInteger iterator    = 2;

            while (primeLenght >= primeNumber.ToString().Length)
            {
                if (primeLenght <= primeNumber.ToString().Length&& RabinMiler.CheckIfPrimeNumberBignumbers(primeLenght, certainty))
                {
                    primeNumber = iterator;
                    Console.WriteLine(primeNumber);
                }
                iterator += 2;
                Console.WriteLine(iterator);
            }
            return(primeNumber);
        }
Beispiel #6
0
        public static BigInteger FastGeneratePrimeNumberbyLenght(int primeBitLenght, int certainty)
        {
            primeBitLenght = primeBitLenght / 8;

            BigInteger primeNumber = RabinMiler.GetRandomPositivOddBigInteger(primeBitLenght);

            BigInteger iterator = primeNumber;

            while (true)
            {
                if (RabinMiler.CheckIfPrimeNumberBignumbers(iterator, certainty))
                {
                    primeNumber = iterator;

                    if (primeBitLenght <= primeNumber.ToByteArray().Length)
                    {
                        break;
                    }
                }
                iterator += 2;
            }
            return(primeNumber);
        }
 private void GenerateFromToString(string begin, string end)
 {
     RabinMiler.GeneratePrimeNumber(begin, end);
 }
 private void GenerateFromToUINT(uint begin, uint end)
 {
     RabinMiler.BasicGeneratePrimeNumber(begin, end);
 }