comparison libtomcrypt/src/hashes/rmd160.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 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** 13 /**
14 @file rmd160.c 14 @file rmd160.c
35 6, 35 6,
36 36
37 &rmd160_init, 37 &rmd160_init,
38 &rmd160_process, 38 &rmd160_process,
39 &rmd160_done, 39 &rmd160_done,
40 &rmd160_test 40 &rmd160_test,
41 NULL
41 }; 42 };
42 43
43 /* the five basic functions F(), G() and H() */ 44 /* the five 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)))
447 448
448 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { 449 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
449 rmd160_init(&md); 450 rmd160_init(&md);
450 rmd160_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); 451 rmd160_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg));
451 rmd160_done(&md, buf); 452 rmd160_done(&md, buf);
452 if (memcmp(buf, tests[x].md, 20) != 0) { 453 if (XMEMCMP(buf, tests[x].md, 20) != 0) {
453 #if 0 454 #if 0
454 printf("Failed test %d\n", x); 455 printf("Failed test %d\n", x);
455 #endif 456 #endif
456 return CRYPT_FAIL_TESTVECTOR; 457 return CRYPT_FAIL_TESTVECTOR;
457 } 458 }
462 463
463 #endif 464 #endif
464 465
465 466
466 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd160.c,v $ */ 467 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd160.c,v $ */
467 /* $Revision: 1.5 $ */ 468 /* $Revision: 1.8 $ */
468 /* $Date: 2005/05/23 02:42:07 $ */ 469 /* $Date: 2006/11/01 09:28:17 $ */