RSA Implementation

Instructions






P:
Q:
n: =
Φ(n): =
Public Key : = ()
Private Key : = ()

Encrypted Data:

Data:
Decrypted Data:


Scanner sc=new Scanner(System.in);            
p=sc.nextInt();
q=sc.nextInt();
            
n=P*Q
phi=(P-1)*(Q-1)
for(e=2;e<phi;e++)
{
    if(gcd(e,phi)==1 && e!=p && e!=q)
    { 
        System.out.println(e);
        break;
    }
}
function prkey(){
    var i;
    for(i=1;i<=9;i++)
    {
        int x=1+(i*phi);
        if(x%e==0)
        {
            d=x/e;                       
            break;
        }
    }        
}
encmsg=Math.pow(Integer.parseInt(msg),evalue)%n;
decmsg=pow(encmsg,d)%N; 

Attempt Task

  1. John wants to set up his own public and private keys. He chooses p = 13 and q = 19 with e = 23. Find d?





  2. For p = 17 and q = 11 and choose e=7. Apply RSA algorithm where message=88 and find the cipher text?