Mercurial > dropbear
comparison libtomcrypt/src/hashes/rmd128.c @ 382:0cbe8f6dbf9e
propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f)
to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 11 Jan 2007 02:41:05 +0000 |
parents | 1b9e69c058d2 |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
379:b66a00272a90 | 382:0cbe8f6dbf9e |
---|---|
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 $ */ |