Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please explain your steps and process to get this code In C + + create the following functions: MRT = > Use Miller - Rabin

Please explain your steps and process to get this code
In C++ 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 primes p and q of s bits using MRT where p is not equal to q.
Calculate n=p*q, and (n)=(p-1)*(q-1)
Chose randomly e from the set of {1,...,n-1} and check using EA if gcd(e,(n))=1 if not chosen again until it fulfills the condition.
Calculate d=e-1 mod (n) using EEA. Note that d should be at least 0.3*s bits
Output kPub=(n,e) and kPr =(d)
RSA Encryption with input kPub=(n,e) and random plaintext x and output should be ciphertext y, evaluate exponentiation using the function powmod_sm
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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions