ElaKiri Community
Downloads
Go Back   ElaKiri Community > Computers & Internet > Problems and Troubleshooting
Reload this Page Programming In C
Reply
 
Thread Tools Display Modes
(#1)
Old
~Zimba~'s Avatar
~Zimba~ ~Zimba~ is offline
Senior Member
~Zimba~ is a jewel in the rough~Zimba~ is a jewel in the rough~Zimba~ is a jewel in the rough~Zimba~ is a jewel in the rough~Zimba~ is a jewel in the rough~Zimba~ is a jewel in the rough
 
Posts: 832
Join Date: Apr 2012
Programming In C - 05-25-2012, 10:17 AM

This is an encryption code. Please give me the decryption code of this. I don't know how to write that. Please help me guys.



#include <stdio.h>
#include <math.h>

int main()
{
static char original[10];
static char encrypted[10];
static int j,value,power;
char ch,temp;

while((ch = getchar()) != EOF)
{
temp = ch;

for(j=5; j>=0; j--)
{ original[j] = ch*5;
ch = ch/5;
}

encrypted[2] = original[0];
encrypted[1] = original[1];
encrypted[0] = original[2];
encrypted[5] = original[3];
encrypted[4] = original[4];
encrypted[3] = original[5];

power = 5;

for(j=0; j<=5; j++)
{ value = value + pow(2,power)* encrypted[j];
power--;
}

printf("%c",value);

}

return 0;
}
Reply With Quote
(#2)
Old
akozlov68's Avatar
akozlov68 akozlov68 is offline
Senior Member
akozlov68 is just really niceakozlov68 is just really niceakozlov68 is just really niceakozlov68 is just really niceakozlov68 is just really niceakozlov68 is just really niceakozlov68 is just really nice
 
Posts: 1,606
Join Date: Nov 2011
Location: Sri Lanaka
05-25-2012, 10:20 AM

bump
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright © 2006 - 2011 ElaKiri™ Beta2.Evo vBulletin, vBa iBproArcade Subdreamer I-Magic MKv
Optimisation plugin by DBtech

Page generated in 0.05321 seconds with 6 queries