Ash's Blog

CN Lab Prog –>> DES

Posted on: March 8, 2011

/*DES algorithm*/

#include <stdio.h>

#include <conio.h>

#include <stdlib.h>

#include <string.h>

void main()

{

int i,ch,lp;

char cipher[50],plain[50];

char key[50];

clrscr();

while(1)

{

pf(“\n—–MENU—–“);

pf(“\n1:Data Encryption \t2:Data Decryption \t 3:Exit”);

pf(“\nEnter your Choice:”);

sf(“%d”,&ch);  switch(ch)

{

case 1: pf(“\nData encrption”);

pf(“\nEnter the plain Text:”);

fflush(stdin);

gets(plain);

pf(“\n Enter the Encryption key:”);

gets(key);

lp=strlen(key);

for(i=0;plain[[i]!=”;i++)

cipher[i]=plain[i]^lp;

cipher[i]=”;

pf(“\nThe encrypted text is:”);

puts(cipher);

break;

case 2: pf(“\nData decrytion”);

for(i=0;cipher[i]!=”;i++)

plain[i]=cipher[i]^lp;

pf(“\nDecrypted Text is:”); puts(plain);

break;

case 3:exit(0);

}

}

getch();

}

 

 

 

Advertisements

1 Response to "CN Lab Prog –>> DES"

[…] Notify me of follow-up comments via email. Subscribe to this site by email « CN Lab Prog –>> DES […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow up !

Enter your email address to follow this blog and receive notifications of new posts by email.

iTweet :

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Where are you?

%d bloggers like this: