Question: Implement RSA by following the specification in the textbook (also attached at the end of this file). Specifically, the core functions, (a) key generation and

 Implement RSA by following the specification in the textbook (also attached

at the end of this file). Specifically, the core functions, (a) key

Implement RSA by following the specification in the textbook (also attached at the end of this file). Specifically, the core functions, (a) key generation and (b) encryption/decryption, should be implemented. Pre/post conditions of the functions are as follows: KeyGen (p, q) -> (e, n), (d, n): This function takes as input two primes then outputs public/private keys. There is no restriction for the type of input/output. RSA (k, M) -> This function takes as input a key (private or public) and a message (or a ciphertext) then outputs a ciphertext (or a plaintext) For the simplicity, the following assumptions should be applied: . The KeyGen function takes two primes, both of them are smaller than 100 (no need to check whether they are primes). . The KeyGen function should randomly select the private key 'e' in the range of 3 and A brute-force approach can be used to find a multiplicative inverse (no need to implement extended Euclidean Algorithm). The RSA function does not have to check the type of input, which means we do not care the input is a ciphertext or a plaintext. In case of encryption, RSA function takes as input an integer range from 0 to 256 then outputs a ciphertext in an integer form. It can be extended to take a list of integers, which is optional. Example: pp 23, 94 29 1. Key Generation, 2. Encryption/Decryption, 3. quit => Enter two primes -> 23, 29 Private key -> (3, 667) Public Key => {411, 667F 1. Key Generation, 2. Encryption/Decryption, 3. quit -> 2 Enter key and message -> {3, 667), [43, 59, 42, 52, 20, 37, 34, 30, 30] Result -> [134, 610, 51, 538, 663, 628, 618, 320, 320] 1. Key Generation, 2. Encryption/Decryption, 3. quit => 2 Enter key and message -> {411, 667), [134, 610, 51, 538, 663, 628, 618, 320, 320] Result -> [43, 59, 42, 52, 20, 37, 34, 30, 30] 1 . Key Generation, 2. Encryption/Decryption, 3. quit => 3 Process finished with exit code 0

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 General Management Questions!