Here\'s the link for the Howework that I need also, in case you want to have a l
ID: 3582369 • Letter: H
Question
Here's the link for the Howework that I need also, in case you want to have a look at it. The code that was there, did not work :(
https://www.chegg.com/homework-help/questions-and-answers/build-crypto-system-c-python-please-able-run-code-without-errors-build-rsa-crypto-system-f-q16806815
Explanation / Answer
def miller_rabin(n, k=10): if n == 2: return True if not n & 1: return False def check(a, s, d, n): x = pow(a, d, n) if x == 1: return True for i in xrange(s - 1): if x == n - 1: return True x = pow(x, 2, n) return x == n - 1 s = 0 d = n - 1 while d % 2 == 0: d >>= 1 s += 1 for i in xrange(k): a = randrange(2, n - 1) if not check(a, s, d, n): return False return True # benchmark of 10000 iterations of miller_rabin(100**10-1); Which is not prime. # 10000 calls, 11111 per second. # 74800 function calls in 0.902 seconds
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.