Пример #1
0
    def test_MillerRabinTruePositive(self):
        assert miller_rabin(131, 10)

        assert miller_rabin(3319, 10)

        assert miller_rabin(77777777977777777, 10)
Пример #2
0
 def test_MillerRabinFalsePositive(self):
     prime = miller_rabin(3825123056546413051, 9,
                          [2, 3, 5, 7, 11, 13, 17, 19, 23])
     assert prime
Пример #3
0
    def test_MillerRabinFermatNumbers(self):
        prime = miller_rabin(65537, 10)
        assert prime

        prime = miller_rabin(4294967297, 10)
        assert not prime
Пример #4
0
    def test_MillerRabinTrueNegative(self):
        assert not miller_rabin(100, 10)

        assert not miller_rabin(82907, 10)

        assert not miller_rabin(5505024, 10)
Пример #5
0
 def __test_prime_millerRabin_fermat(self, prime, times_to_check):
     fermat_check = fermat(prime, times_to_check)
     miller_rabin_check = miller_rabin(prime, times_to_check)
     assert miller_rabin_check and fermat_check
Пример #6
0
 def __test_prime_millerRabin(self, prime, times_to_check):
     miller_rabin_check = miller_rabin(prime, times_to_check)
     assert miller_rabin_check