{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

applied cryptography - protocols, algorithms, and source code in c

# for i0i64i p a 0x7fc b keytp4 a

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ototypes and structures. */ /* ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– */ void mu(word32 *a) /* inverts the order of the bits of a */ { int i ; word32 b[3] ; b[0] = b[1] = b[2] = 0 ; for( i=0 ; i<32 ; i++ ) { b[0] <<= 1 ; b[1] <<= 1 ; b[2] <<= 1 ; if(a[0]&amp1) b[2] |= 1 ; if(a[1]&amp1) b[1] |= 1 ; if(a[2]&amp1) b[0] |= 1 ; a[0] >>= 1 ; a[1] >>= 1 ; a[2] >>= 1 ; } a[0] = b[0] ; a[1] = b[1] ; a[2] = b[2] ; } void gamma(word32 *a) { word32 b[3] ; /* the nonlinear step */ b[0] = a[0] ^ (a[1]|(~a[2])) ; b[1] = a[1] ^ (a[2]|(~a[0])) ; b[2] = a[2] ^ (a[0]|(~a[1])) ; a[0] = b[0] ; } a[1] = b[1] ; a[2] = b[2] ; void theta(word32 *a) { word32 b[3]; b[0] = a[0] ^ (a[0]>>16) (a[1]>>24) (a[2]>>16) (a[1]>>16) (a[2]>>24) (a[0]>>16) (a[2]>>16) (a[0]>>24) (a[1]>>16) a[1] = /* the linear step */ b[1] = a[1] ^ b[2] = a[2] ^ a[0] = b[0] ; } ^ (a[1]<<16) ^ ^ (a[2]<<8) ^ ^ (a[0]<<16) ^ ^ (a[2]<<16) ^ ^ (a[0]<<8) ^ ^ (a[1]<<16) ^ ^ (a[0]<<16) ^ ^ (a[1]<<8) ^ ^ (a[2]<<16) ^ b[1] ; a[2] = (a[1]>>16) (a[2]>>8) (a[2]>>24) (a[2]>>16) (a[0]>>8) (a[0]>>24) (a[0]>>16) (a[1]>>8) (a[1]>>24) b[2] ; ^ ^ ^ ^ ^ ^ ^ ^ ^ (a[2]<<16) (a[0]<<24) (a[0]<<8) (a[0]<<16) (a[1]<<24) (a[1]<<8) (a[1]<<16) (a[2]<<24) (a[2]<<8) ^ ^ ; ^ ^ ; ^ ^ ; void pi_1(word32 *a) { a[0] = (a[0]>>10) ^ (a[0]<<22); a[2] = (a[2]<<1) ^ (a[2]>>31); } void pi_2(word32 *a) { a[0] = (a[0]<<1) ^ (a[0]>>31); a[2] = (a[2]>>10) ^ (a[2]<<22); } void rho(word32 *a) { theta(a) ; pi_1(a) ; gamma(a) ; pi_2(a) ; } /* the round function */ void rndcon_gen(word32 strt,word32 *rtab) { /* genera...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern