Java not 2 - lr[i+32]=l[i]; } for(i=0;i<64;i++)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
static int cnt,rtemp,n; register int i,j; for(i=n=0;i<8;i++) for(j=0;j<8;j++) inputb[n++]=(input[i]>>j&0x01); for(i=0;i<64;i++){ /*Initial Permutation*/ lr[i]=inputb[p[i]-1]; if(i<32) l[i]=lr[i]; else r[i-32]=lr[i]; } for(cnt=16;cnt>0;cnt--){ /*Main decryption loop*/ cypher(r,cnt,fn); for(i=0;i<32;i++){ rtemp=r[i]; if(l[i]==1 && fn[i]==1) r[i]=0; else r[i]=(l[i] || fn[i]); l[i]=rtemp; } } for(i=0;i<32;i++){ lr[i]=r[i];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lr[i+32]=l[i]; } for(i=0;i&lt;64;i++) out[i]=lr[invp[i]-1]; /*Inverse IP*/ for(i=1;i&lt;=8;i++) for(j=1;j&lt;=8;j++) input[i-1]=(input[i-1]&lt;&lt;1) | out[i*8-j]; } int main(int argc, char *argv){ unsigned char *key; unsigned char data[8]; int n; FILE *in; FILE *out; if (argc!=4) { printf(&quot;\r\nUsage: des [e][d] &lt;source file&gt; &lt;destination file&gt;\r\n&quot;); return 1; } key=(unsigned char*)getpass(&quot;Enter Key:&quot;); des_init(key);...
View Full Document

This note was uploaded on 02/26/2012 for the course MBA IT DOM1 taught by Professor Kviswanathan during the Spring '12 term at Indian Institute of Technology, Chennai.

Ask a homework question - tutors are online