Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help my understand why this code is failing, below i will provide source code and picture of my error. if you can provide fixes

please help my understand why this code is failing, below i will provide source code and picture of my error. if you can provide fixes that would be greatly appreciated. project due very soon! thank you!image text in transcribed

source code:

def powMod_sm(base, exp, n): exp_b=bin(exp) value=base for i in range(3, len(exp_b)): value=(value**2)%n if exp_b[i:i+1]=='1: ': value = (value * base)% n return value # using the euclidean Algorithm def computeGCD(x, y): while y: x, y = y, x % y return x #Extended euclidean Algorithm method to calculate gcd and get the coefficient def extendedGCD(a, b): if a == 0: return b, 0, 1 gcd, x1, y1 = extendedGCD(b % a, a) x = y1 - (b // a)* x1 y = x1 return gcd, x, y # calculating the modular inverse using EEA def mod_Inv(b, n): gcd, _, t = extendedGCD(n, b) if gcd==1: i = t % n elif gcd!=1: print("Inverse is undefined") return i #miller-rabin Primality test def mrt(p): if p == 2 or p == 3: return True if p

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

More Books

Students also viewed these Databases questions