In your favorite language (preferable in Python) create the following functions:
MRT=>Use Miller-Rabin Primality Test to choose a prime number with s=512 bits and check the primality test.
EA=>Use Euclidean Algorithm to evaluate gcd
EEA=>Use Extended Euclidean Algorithm to find modular inverse of the value
powmod_sm=>Square and multiply algorithm to evaluate exponentiation.
Now write the code for
RSA Key Generation (use above functions 1., 2., 3. ) should be
Choose two primespandqofsbits usingMRTwherepis not equal toq.
Calculaten=p*q, andϕ(n) = (p-1)*(q-1)
Chose randomly e from the set of {1,…,ϕn-1} and check using EA ifgcd(e, ϕ(n))=1if not chosen again until it fulfills the condition.
Calculated=e-1mod ϕ(n)using EEA. Note thatdshould be at least0.3*sbits
OutputkPub=(n,e)andkPr= (d)
RSA Encryption with inputkPub=(n,e)and random plaintextxand output should be ciphertexty, evaluate exponentiation using the functionpowmod_sm
RSA Decryption with inputkPr= (d)and ciphertextyand output should be plaintextx, evaluate exponentiation using the functionpowmod_sm. Please make sure to check that you get the same plaintext value before the encryption.
Please write your report and include a snapshot of output with you source code.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here