[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trouble with idea.c from cryptl99.zip



Hey, I downloaded the crypto lib 'cryptl99.zip' from one of the crypto 
web sites, I got IDEA.C to compile, but it doesn't seem to encrypt.  
The test code that comes with it shows the sub-key groupings, then it 
does this

X 0 1 2 3 4 5 6 7
Y 0 1 2 3 4 5 6 7
Z 0 1 2 3 4 5 6 7


It looks like X should be the plaintext, Y the ciphertext, then Z the 
plaintext again from the code, but it isn't working.  If anyone knows 
the source code I am talking about let me know what is wrong. Here is 
what the main piece looks like:

printf("\n Encrypting %d bytes (%ld blocks)...", BLOCKS*16, BLOCKS);
	fflush(stdout);
	start = clock();
	memcpy(YY, XX, 8);
	for (l = 0; l < BLOCKS; l++)
		ideaCipher(YY, YY, EK);	/* repeated encryption */
	memcpy(ZZ, YY, 8);
	for (l = 0; l < BLOCKS; l++)
		ideaCipher(ZZ, ZZ, DK);	/* repeated decryption */
	end = clock() - start;
	l = end  / (CLOCKS_PER_SEC/1000) + 1;
	i = l/1000;
	j = l%1000;
	l =  4;             // (16 * BLOCKS * (CLOCKS_PER_SEC/1000)) / 
(end/1000);
	printf("%d.%03d seconds = %ld bytes per second\n", i, j, l);

	printf("\nX %3u  %3u  %3u  %3u  %3u  %3u  %3u %3u\n",
	  XX[0], XX[1],  XX[2], XX[3], XX[4], XX[5],  XX[6], XX[7]);
	printf("\nY %3u  %3u  %3u  %3u  %3u  %3u  %3u %3u\n",
	  YY[0], YY[1],  YY[2], YY[3], YY[4], YY[5],  YY[6], YY[7]);
	printf("\nZ %3u  %3u  %3u  %3u  %3u  %3u  %3u %3u\n",    
	  ZZ[0], ZZ[1],  ZZ[2], ZZ[3], ZZ[4], ZZ[5],  ZZ[6], ZZ[7]);


from this, Y should be encrypted, but it isn't! Thanks in advance for 
any help.
-- 
 [email protected]
"It can't rain all the time"