Dat 10 - lshift(c); lshift(d); }...

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

View Full Document Right Arrow Icon
16,7,27,20,13,2, 41,52,31,37,47,55, 30,40,51,45,33,48, 44,49,39,56,34,53, 46,42,50,36,29,32}; static int nls[17] = { 0,1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1}; static int cd[56],keyb[64]; static int cnt,n=0; register int i,j; for(i=0;i<8;i++) /*Read in key*/ for(j=0;j<8;j++) keyb[n++]=(key[i]>>j&0x01); for(i=0;i<56;i++) /*Permuted choice 1*/ cd[i]=keyb[pc1[1]-1]; for(i=0;i<28;i++){ c[i]=cd[i]; d[i]=cd[i+28]; } for(cnt=1;cnt<=16;cnt++){ for(i=0;i<nls[cnt];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: lshift(c); lshift(d); } for(i=0;i&lt;28;i++){ cd[i]=c[i]; cd[i+28]=d[i]; } for(i=0;i&lt;48;i++) /*Permuted Choice 2*/ keyout[cnt][i]=cd[pc2[i]-1]; } } static void lshift(unsigned char shft){ register int temp,i; temp=shft[0]; for(i=0;i&lt;27;i++) shft[i]=shft[i+1]; shft[27]=temp; } static void cypher(int *r, int cnt, int *fout){ static int expand[48],b[8][6],sout[8],pin[48];...
View Full Document

Ask a homework question - tutors are online