RSA ALGORITHM IMPLEMENTATION
#1

RSA ALGORITHM IMPLEMENTATION



/********** RSA PROGRAM ***********/
/*d value should be less than 11 bcoz (c^d)modn can't be computed using available
datatypes*/

#include<stdio.h>
#include<string.h>
#include<math.h>
void main()
{
char a[]={"0ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
int n,i,j,s,n2,k1,p,q,d,m1,e1,l5,z,p2[30],s1,c[30];
unsigned long int l3,m,l4,k2;
double l2,l1,l6;
float e,l;
char p1[30];
clrscr();
printf("enter two prime numbers p and q\n");
scanf("%d %d",&p,&q);
do{
n=p*q;
if(n<26)
{ printf("\n n value is not large enough.\nplease select p, q value such that p*q is greater than
26");
scanf("%d %d",&p,&q);}
}
while(n<26);
z=((p-1)*(q-1));
printf("enter the value of d:\n");
scanf("%d",&d);
for(j=1;j<z;j++)
{
if((j*d)%z==1)
break;
}
e=j;
printf("%d %d %f\n",n,z,e);
printf("ENCRYPTION-CIPHERTEXT");
printf("enter the plain text\n");
scanf("%s",p1);
for(i=0;i<strlen(p1);i++)
{
for(j=1;j<strlen(a);j++)
{
if(a[j]==p1[i])
{
s=j;
break;
}
else
continue;
}
printf("%d",s);
e1=(int)e;
l1=pow(((double)s),((double)e1));
k2=fmod(l1,(double)n);
printf("\n%lu\n",k2);
c[i]=(int)k2;
printf("cipher:%d\n",c[i]);
}
printf("\n");
for(i=0;i<strlen(p1);i++)
{
l2=(pow(((double)c[i]),((double)d)));
m=fmod(l2,(double)n);
m1=(int)m;
printf(" %c\n",a[m1]);}
getch();
}
RSA OUTPUT
Enter two prime numbers p and q
3 11
enter the value of d:
7
33 20 3.000000
ENCRYPTION-CIPHER TEXT
enter the plain text
SUZANNE
19
28
cipher:28
21
21
cipher:21
26 20 cipher:20
1 1 cipher:1
14 5 cipher:5
14 5 cipher:5
5 26 cipher:26
S U Z A N N E
s
Reply
#2

to get information about the topic "meaning of data dynamics in cloud computing" full report ppt and related topic refer the page link bellow

http://studentbank.in/report-rsa-algorit...ementation

http://studentbank.in/report-rsa-algorit...e=threaded

http://studentbank.in/report-rsa-algorit...e=threaded

http://studentbank.in/report-public-key-...-algorithm
Reply
#3

RSA ALGORITHM IMPLEMENTATION[/b]


This CODING IS NOT WORKING.......
/********** RSA PROGRAM ***********/
/*d value should be less than 11 bcoz (c^d)modn can't be computed using available
datatypes*/

#include<stdio.h>
#include<string.h>
#include<math.h>
void main()
{
char a[]={"0ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
int n,i,j,s,n2,k1,p,q,d,m1,e1,l5,z,p2[30],s1,c[30];
unsigned long int l3,m,l4,k2;
double l2,l1,l6;
float e,l;
char p1[30];
clrscr();
printf("enter two prime numbers p and q\n");
scanf("%d %d",&p,&q);
do{
n=p*q;
if(n<26)
{ printf("\n n value is not large enough.\nplease select p, q value such that p*q is greater than
26");
scanf("%d %d",&p,&q);}
}
while(n<26);
z=((p-1)*(q-1));
printf("enter the value of d:\n");
scanf("%d",&d);
for(j=1;j<z;j++)
{
if((j*d)%z==1)
break;
}
e=j;
printf("%d %d %f\n",n,z,e);
printf("ENCRYPTION-CIPHERTEXT");
printf("enter the plain text\n");
scanf("%s",p1);
for(i=0;i<strlen(p1);i++)
{
for(j=1;j<strlen(a);j++)
{
if(a[j]==p1[i])
{
s=j;
break;
}
else
continue;
}
printf("%d",s);
e1=(int)e;
l1=pow(((double)s),((double)e1));
k2=fmod(l1,(double)n);
printf("\n%lu\n",k2);
c[i]=(int)k2;
printf("cipher:%d\n",c[i]);
}
printf("\n");
for(i=0;i<strlen(p1);i++)
{
l2=(pow(((double)c[i]),((double)d)));
m=fmod(l2,(double)n);
m1=(int)m;
printf(" %c\n",a[m1]);}
getch();
}
RSA OUTPUT
Enter two prime numbers p and q
3 11
enter the value of d:
7
33 20 3.000000
ENCRYPTION-CIPHER TEXT
enter the plain text
SUZANNE
19
28
cipher:28
21
21
cipher:21
26 20 cipher:20
1 1 cipher:1
14 5 cipher:5
14 5 cipher:5
5 26 cipher:26
S U Z A N N E
s

[/quote]

Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: rsa algorithm implementation using java swings, implementation of rsa in java for cryptography minor project, video on rsa algorithm, rsa algorithm pdf, implementation of rsa, rsa implementation ppt in c and c, rsa algorithm by shamine,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Resizing image using bilinear interpolation algorithm in MATLAB seminar addict 1 2,662 13-01-2013, 10:15 PM
Last Post: Guest
  Bresenham Line Drawing Algorithm Circle Drawing & Polygon Filling project report helper 1 4,623 16-12-2012, 07:35 AM
Last Post: Guest
  Offline Handwriting Recognition Using Genetic Algorithm project uploader 1 2,623 09-11-2012, 12:27 PM
Last Post: seminar details
  Stego Machine – Video Steganography using Modified LSB Algorithm seminar details 1 2,444 25-10-2012, 01:40 PM
Last Post: seminar details
  ECONOMIC LOAD DISPATCH WITH VALVE-POINT EFFECT USING ARTIFICIAL BEE COLONY ALGORITHM seminar addict 1 1,868 24-10-2012, 04:02 PM
Last Post: seminar details
  DESIGN AND IMPLEMENTATION OF LASER BASED HOME SECURITY SYSTEM seminar addict 1 2,363 22-10-2012, 02:29 PM
Last Post: seminar details
  VLSI Design and Implementation of Low Power MAC Unit with Block Enabling Technique project uploader 1 1,653 02-10-2012, 01:09 PM
Last Post: seminar details
  Implementation of an IEEE 802.11 Wireless LAN Model using OPNET seminar details 0 1,235 11-06-2012, 05:58 PM
Last Post: seminar details
  The Geometric Efficient Matching Algorithm for Firewalls seminar details 0 1,201 09-06-2012, 05:16 PM
Last Post: seminar details
  IMPLEMENTATION OF DSP BASED SENSORLESS CONTROL WITH DIRECT BACK-EMF DETECTION ....... project uploader 0 1,140 09-06-2012, 04:56 PM
Last Post: project uploader

Forum Jump: