Public key cryptography & RSA Algorithm

Souurce Code:

#include<stdio.h>
#include<conio.h>
int phi,M,n,e,d,C,FLAG;
int check()
{
int i;
for(i=3;e%i==0 && phi%i==0;i+2)
{
FLAG = 1;
return 0;
}
FLAG = 0;
}
void encrypt()
{
int i;
C = 1;
for(i=0;i< e;i++)
C=C*M%n;
C = C%n;
printf("\n\t Encrypted keyword : %d",C);
}
void decrypt()
{
int i;
M = 1;
for(i=0;i< d;i++)
M=M*C%n;
M = M%n;
printf("\n\t Decrypted keyword : %d",M);
}
void main()
{
int p,q,s;
clrscr();
printf("\n Enter Two Relatively Prime Numbers\t: ");
scanf("%d%d",&p,&q);
n = p*q;
phi=(p-1)*(q-1);
printf("\n\tF(n) phi value\t= %d",phi);

 

 

 

Public key cryptography by mrs.m.sharmila banu & Ms.R.jayabharathi