comparison libtomcrypt/src/hashes/whirl/whirl.c @ 398:59c7938af2bd

merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c' and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:30 +0000
parents 0cbe8f6dbf9e
children f849a5ca2efc
comparison
equal deleted inserted replaced
396:e7c1a77d2921 398:59c7938af2bd
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 * 8 *
9 * Tom St Denis, [email protected], http://libtomcrypt.org 9 * Tom St Denis, [email protected], http://libtomcrypt.com
10 */ 10 */
11 11
12 /** 12 /**
13 @file whirl.c 13 @file whirl.c
14 WHIRLPOOL (using their new sbox) hash function by Tom St Denis 14 WHIRLPOOL (using their new sbox) hash function by Tom St Denis
30 6, 30 6,
31 31
32 &whirlpool_init, 32 &whirlpool_init,
33 &whirlpool_process, 33 &whirlpool_process,
34 &whirlpool_done, 34 &whirlpool_done,
35 &whirlpool_test 35 &whirlpool_test,
36 NULL
36 }; 37 };
37 38
38 /* the sboxes */ 39 /* the sboxes */
39 #include "whirltab.c" 40 #include "whirltab.c"
40 41
287 288
288 for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { 289 for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
289 whirlpool_init(&md); 290 whirlpool_init(&md);
290 whirlpool_process(&md, (unsigned char *)tests[i].msg, tests[i].len); 291 whirlpool_process(&md, (unsigned char *)tests[i].msg, tests[i].len);
291 whirlpool_done(&md, tmp); 292 whirlpool_done(&md, tmp);
292 if (memcmp(tmp, tests[i].hash, 64) != 0) { 293 if (XMEMCMP(tmp, tests[i].hash, 64) != 0) {
293 #if 0 294 #if 0
294 printf("\nFailed test %d\n", i); 295 printf("\nFailed test %d\n", i);
295 for (i = 0; i < 64; ) { 296 for (i = 0; i < 64; ) {
296 printf("%02x ", tmp[i]); 297 printf("%02x ", tmp[i]);
297 if (!(++i & 15)) printf("\n"); 298 if (!(++i & 15)) printf("\n");
307 308
308 #endif 309 #endif
309 310
310 311
311 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirl.c,v $ */ 312 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirl.c,v $ */
312 /* $Revision: 1.5 $ */ 313 /* $Revision: 1.8 $ */
313 /* $Date: 2005/05/23 02:42:07 $ */ 314 /* $Date: 2006/11/01 09:28:17 $ */