{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

5560 15 lm adleman on breaking generalized knapsack

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ec(“KEY = ”,k); printvec(“PLAIN = ”,a); encrypt(&ampgc,a); printvec(“CIPHER = ”,a); /* Test vector 3. */ k[2]=0xbcdef012;k[1]=0x456789ab;k[0]=0xdef01234; a[2]=0×01234567;a[1]=0x9abcdef0;a[0]=0x23456789; twy_key(&ampgc,k); printf(“**********\n”); printvec(“KEY = ”,k); printvec(“PLAIN = ”,a); encrypt(&ampgc,a); printvec(“CIPHER = ”,a); /* Test vector 4. */ k[2]=0xcab920cd;k[1]=0xd6144138;k[0]=0xd2f05b5e; a[2]=0xad21ecf7;a[1]=0x83ae9dc4;a[0]=0x4059c76e; twy_key(&ampgc,k); printf(“**********\n”); printvec(“KEY = ”,k); printvec(“PLAIN = ”,a); encrypt(&ampgc,a); printvec(“CIPHER = ”,a); /* TEST VALUES key : 00000000 00000000 00000000 plaintext : 00000001 00000001 00000001 ciphertext : ad21ecf7 83ae9dc4 4059c76e key : 00000004 00000005 00000006 plaintext : 00000001 00000002 00000003 ciphertext : cab920cd d6144138 d2f05b5e key : bcdef012 456789ab def01234 plaintext : 01234567 9abcdef0 23456789 ciphertext : 7cdb76b2 9cdddb6d 0aa55dbb key : cab920cd d6144138 d2f05b5e plaintext : ad21ecf7 83ae9dc4 4059c76e ciphertext : 15b155ed 6b13f17c 478ea871 */ /* Enc/dec test: */ for(i=0;i<9;i++) a[i]=i; twy_enc(&ampgc,a,3); for(i=0;i<9;i+=3) printf(“Block %01d encrypts to %08lx %08lx %08lx\n”, i/3,a[i],a[i+1],a[i+2]); twy_dec(&ampgc,a,2); twy_dec(&ampgc,a+6,1); for(i=0;i<9;i+=3) printf(“Block %01d decrypts to %08lx %08lx %08lx\n”, i/3,a[i],a[i+1],a[i+2]); } RC5 #include <stdio.h> /* An RC5 context needs to know how many rounds it has, and its subkeys. */ typedef struct { u4 *xk; int nr; } rc5_ctx; /* Where possible, these should be replaced with actual rotate instructions. For Turbo C++, this is done with _lrotl and _lrotr. */ #define ROTL32(X,C) (((X)<<(C))|((X)>>(32–(C)))) #define ROTR32(X,C) (((X)>>(C))|((X)<<(32–(C)))) /* Function prototypes for dealing with RC5 basic operations. */ void rc5_init(rc5_ctx *, int); void rc5_destroy(rc5_ctx *); void rc5_key(rc5_ctx *, u1 *, int); void rc5_encrypt(rc5_c...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern