Pages

Saturday, February 25, 2017

RSA Encryption

Sample values taken for execution of RSA encryption are as under:

      e=7, d=23, n=187 and m=88

#include<stdio.h>
int main()
{
  long int e=7,n=187,d=23, m=88, c;
  int i;
  //you may read e,n,d and m from user.

  printf("Sample Data:e=7, d=23, n=187, m=88\n");

  c=1;
  for(i=0; i<e; i++)
{
    c = c*m%n;
  }
  c = c%n;
  printf("Cipher Text of %i = %i \n",m, c);

  return 0;
}

Output of program:

Sample Data:e=7, d=23, n=187, m=88
Cipher Text of 88 = 11



No comments:

Post a Comment