Mercurial > dropbear
comparison libtomcrypt/src/hashes/rmd160.c @ 415:8b9aba1d5fa4 channel-fix
merge of '73fe066c5d9e2395354ba74756124d45c978a04d'
and 'f5014cc84558f1e8eba42dbecf9f72f94bfe6134'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 06 Feb 2007 16:00:18 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
414:c53a26c430e5 | 415:8b9aba1d5fa4 |
---|---|
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 $ */ |