Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to Encrypt and decrypt a text data using RSA algorithm
#1

Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
  double p,q,n,m,e,k,z,d1,c1,c2,y;
  double d,l,x,c,d2;
  clrscr();
  printf("The P,Q Primary values:");
  scanf("%lf%lf",&p,&q);
  n=p*q;
  printf("N value is %lf",n);
  k=(p-1)*(q-1);
  printf("\n K(n) value is:%lf",k);
  printf("\n Enter the Integer which is relative to the prime to the K(n)");
  scanf("%lf",&e);
  d2=pow(e,-1);
  d=fmod(d2,k);
  printf("%lf",&d);
  printf("\n Enter the plain text number ");
  scanf("%lf",&m);
  d1=pow(m,e);
  c=fmod(d1,n);
  printf("\n Encription of the plain text:%lf\n",c);
  c2=pow(d1,d);
  x=fmod(c2,n);
  printf("\n Description of the plain text: %lf\n",x);
  getch();
  }
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.