Pages

Saturday, February 25, 2017

RSA Decryption

#include<stdio.h>
int main()
{
long int n=187, d=23, m, c=11;
int i;
//Assuming input - Cipher text c=11.

printf("Sample Data:d=23, n=187, c=11\n");

m = 1;

for(i=0; i<d; i++){
m = m * c%n;
}
m = m%n;

printf("Plain Text of %i = %i",c,m);
return 0;
}

Output of program:

Sample Data:d=23, n=187, c=11
Plain Text of 11 = 88

No comments:

Post a Comment