comparison src/hashes/rmd128.c @ 380:d5faf4814ddb libtomcrypt-orig libtomcrypt-1.16

Update to LibTomCrypt 1.16
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:22:00 +0000
parents 59400faa4b44
children
comparison
equal deleted inserted replaced
280:59400faa4b44 380:d5faf4814ddb
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 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** 13 /**
14 @param rmd128.c 14 @param rmd128.c
35 6, 35 6,
36 36
37 &rmd128_init, 37 &rmd128_init,
38 &rmd128_process, 38 &rmd128_process,
39 &rmd128_done, 39 &rmd128_done,
40 &rmd128_test 40 &rmd128_test,
41 NULL
41 }; 42 };
42 43
43 /* the four basic functions F(), G() and H() */ 44 /* the four basic functions F(), G() and H() */
44 #define F(x, y, z) ((x) ^ (y) ^ (z)) 45 #define F(x, y, z) ((x) ^ (y) ^ (z))
45 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) 46 #define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
388 389
389 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { 390 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
390 rmd128_init(&md); 391 rmd128_init(&md);
391 rmd128_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); 392 rmd128_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg));
392 rmd128_done(&md, buf); 393 rmd128_done(&md, buf);
393 if (memcmp(buf, tests[x].md, 16) != 0) { 394 if (XMEMCMP(buf, tests[x].md, 16) != 0) {
394 #if 0 395 #if 0
395 printf("Failed test %d\n", x); 396 printf("Failed test %d\n", x);
396 #endif 397 #endif
397 return CRYPT_FAIL_TESTVECTOR; 398 return CRYPT_FAIL_TESTVECTOR;
398 } 399 }
403 404
404 #endif 405 #endif
405 406
406 407
407 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */ 408 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */
408 /* $Revision: 1.6 $ */ 409 /* $Revision: 1.9 $ */
409 /* $Date: 2005/05/23 02:42:07 $ */ 410 /* $Date: 2006/11/01 09:28:17 $ */