Question: i dont understand what im missing to make this project work. below is my source code attatched is the project. please help me! source code:

i dont understand what im missing to make this project work. below is my source code attatched is the project. please help me!

source code:

import random

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

i dont understand what im missing to make this project work. below

In your favorite language (preferable in Python) create the following functions: 1. MRT Use Miller-Rabin Primality Test to choose prime number with s=512 bits and check the primality test. 2. EA Use Euclidean Algorithm to evaluate gcd 3. EEA Use Lxtended Luclidean Algorithm to find modular inverse of the value 4. powmod_sm Square and multiply algorithm to evaluate exponentiation. Now write the code for I. RSA Key Generation (use above functions 1., 2., 3.) should be a. Choose two primes p and q of s bits using MRT where p is not equal to q. b. Calculate n=pq, and (n)=(p1)(q1) c. Chose randomly e from the set of {1,,(n)1} and check using E if gcd(e,(n))=1 if not chose again until it full fills the condition. d. Calculate d=e1mod(n) using EEA. Note that d should be at least 0.3s bits e. Output kpub=(n,e) and kpr=(d) II. RSA Encryption with input kPub=(n,e) and random plaintext x and output should be ciphertext y, evaluate exponentiation using the function powmod_sm III. RSA Decryption with input kPr=(d) and ciphertext y and output should be plaintext x, evaluate exponentiation using the function powmod sm. Please make sure to check that you get the same plaintext value before the encryption

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!