This assignment is a rsa project. please help me with it? Generate two prime numbers at least 1 million. These are p and q. n = pxq.
Show how and show p and q
* Find d and e . Show how and show d and e.
* Encrypt message 100. use the above results. show this number. Programming language! C++
Please add some comments to the program. Thank you
Code:
#include<iostream>
#include<math.h>
using namespace std;
int gcd(int a,int b){ //to fing gcd of two numbers
int t; // variable to store remainder
while(1){ // infinite loop
t=a%b; // finding remainder of two
numbers
if(t==0){ // if remainder is zero
then we found gcd
return b;
}
a=b;
b=t;
}
}
int main(){
double p=103; // two prime numbers
double q=107;
double n=p*q; // calculating n value
double phi=(p-1)*(q-1); //calculating phi value
double e=2;
while (e<phi){ // finding e value where e<n such that
gcd(e,phi)=1
if(gcd(e,phi)==1){ // if gcd of two numbers is 1 then
store i value into e
break;
}
else{
e++;
}
}
double d1=1/e; // claculating d value
double d=fmod(d1,phi);
double message=100;
double c=pow(message,e); //cypher text or encrypted message
variable
double m=pow(c,d); //decrypt variable to decrypt encrypted
message
c=fmod(c,n);
m=fmod(m,n);
cout<<"p value: "<<p<<endl;
cout<<"q value: "<<q<<endl;
cout<<"e value: "<<e<<endl;
cout<<"d value: "<<d<<endl;
cout<<"n value: "<<n<<endl;
cout<<"phi value: "<<phi<<endl;
cout<<"e value: "<<e<<endl;
cout<<"d value: "<<d<<endl;
cout<<"Original Message: "<<message<<endl;
cout<<"Encrypted message: "<<c<<endl;
cout<<"Decrypted message: "<<m<<endl;
}
Output:

This assignment is a rsa project. please help me with it? Generate two prime numbers at...
In a RSA cryptosystem, a participant A uses two prime numbers p = 13 and q = 17 to generate her public and private keys. If the public key of A is 35, then the private key of A is 11. Alice wants to encrypt a message to Bob by using the RSA algorithm and using keys in (A) The plaintext = “HI”. Answer: _______________
If we choose two prime numbers p=13 and q=17 in RSA (Rivest-Shamir-Adelman) algorithm, and choose Public Key = (p x q, e) = (221,5), (a) Show the result and procedures to generate Private Key. (b) Show the procedures using the Public Key and the Private Key found in step (a) to encrypt a message M (Assume M=25); and to decrypt for obtaining the message.
Bob chooses 7 and 11 as p and q prime numbers. Now he chooses two exponents e to be 13, then d is 37. Note e * d mod 60 = 1 i.e. they are inverse to each other. Now imagine that Alice wants to send the plaintext 5 to Bob. She uses RSA algorithm to encrypt the message (perform encryption). Also, show your work how Bob perform decryption operation in order to extract plaintext. PLEASE SHOW ALL WORK AND...
C Programming - RSA encryption Hi there, I'm struggling with writing a C program to encrypt and decrypt a string using the RSA algorithm (C90 language only). It can contain ONLY the following libraries: stdio, stdlib, math and string. I want to use the following function prototypes to try and implement things: /*Check whether a given number is prime or not*/ int checkPrime(int n) /*to find gcd*/ int gcd(int a, int h) void Encrypt(); void Decrypt(); int getPublicKeys(); int getPrivateKeys();...
C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt strings using RSA and want to be able to integrate it into a header file which contains codes for compression, linked list etc.. However, the use of global variables and fixed size of encryption is making it hard to do so Can someone please help me modify the following the code? I want to be able to just pass it in a string to...
Consider the RSA algorithm. Let the two prime numbers, p=11 and q=41. You need to derive appropriate public key (e,n) and private key (d,n). Can we pick e=5? If yes, what will be the corresponding (d,n)? Can we pick e=17? If yes, what will be the corresponding (d,n)? (Calculation Reference is given in appendix) Use e=17, how to encrypt the number 3? You do not need to provide the encrypted value.
please help me to solve (c and d) knowing that d=209
Let the two primes p = 41 and q = 17 be given as set-up parameters for RSA. a. Which of the parameters e_1 = 32, e_2 = 49 is a valid RSA exponent? Justify your choice b. Compute the corresponding private key Kpr = (p, q, d). Use the extended Euclidean algorithm for the inversion and point out every calculation step. c. Using the encryption key, encrypt the...
Answer the following: We would like to encrypt the message "HOWDY” using RSA. To do this, we will encrypt each letter individually (H = 8,0 = 15, W = 23, D = 4, Y = 25). Show detailed steps for at least one letter Use p = 17, q = 23, e = 3, m =(8, 15, 23, 4, 25)
C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt strings using RSA and want to be able to integrate it into a header file which contains codes for compression, linked list etc.. However, the use of global variables and fixed size of encryption is making it hard to do so Can someone please help me modify the following the code? I want to be able to just pass it in a string to...
Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA { private BigInteger phi; private BigInteger e; private BigInteger d; private BigInteger num; public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter the message you would like to encode, using any ASCII characters: "); String input = keyboard.nextLine(); int[] ASCIIvalues = new int[input.length()]; for (int i = 0; i < input.length(); i++) { ASCIIvalues[i] = input.charAt(i); } String ASCIInumbers...