I am working a project for RSA Algorithm. I need to encrypt/decrypt messages for certain p,q,e values. I have done that. (Even though it was hard). Now what i need help is about finding these p,q,e values. Here is a short description of RSA:
I can decrypt for known values of p,q,e as i said. But i can't find these values. Here are the steps:
Your enter a word (actually it is a sentence but for now a word) then program will convert letters to numbers (like a=1 m=13 etc.) and group them. Use with all given values n=pq (n is the modulus). C=(m^e) (mod n ) where C is encrypted message m is numbers (converted from letters).
1. Enter encrypted message.
2. Program will try all combinations of p,q,e.
3. For every combination it will check if decrypted message is in the wordlist.(There will be a wordlist containing 50 words)
4. If a word is found it will show p,q,e values. Else it will continue to try until p,q,e all equals to 100.
5. If still no result, program will stop.
I did 3 nested for loops (p,q,e) but no luck. I really need your help.
My code so far:
long int p,q,e,n,inv,s=0,d=1,C,M;
unsigned long int c;
printf("Enter the value of p and q: ");
printf("\nEnter the e value: ");
printf("\nEnter the message to encrypt:");
printf("\n\nEnter encrypted message to decrpyt :\n");
printf("\n\nDecrypted (original) message: ");