Mercurial > dropbear
comparison libtomcrypt/src/hashes/md5.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 /** | 14 /** |
30 6, | 30 6, |
31 | 31 |
32 &md5_init, | 32 &md5_init, |
33 &md5_process, | 33 &md5_process, |
34 &md5_done, | 34 &md5_done, |
35 &md5_test | 35 &md5_test, |
36 NULL | |
36 }; | 37 }; |
37 | 38 |
38 #define F(x,y,z) (z ^ (x & (y ^ z))) | 39 #define F(x,y,z) (z ^ (x & (y ^ z))) |
39 #define G(x,y,z) (y ^ (z & (y ^ x))) | 40 #define G(x,y,z) (y ^ (z & (y ^ x))) |
40 #define H(x,y,z) (x^y^z) | 41 #define H(x,y,z) (x^y^z) |
348 | 349 |
349 for (i = 0; tests[i].msg != NULL; i++) { | 350 for (i = 0; tests[i].msg != NULL; i++) { |
350 md5_init(&md); | 351 md5_init(&md); |
351 md5_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | 352 md5_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); |
352 md5_done(&md, tmp); | 353 md5_done(&md, tmp); |
353 if (memcmp(tmp, tests[i].hash, 16) != 0) { | 354 if (XMEMCMP(tmp, tests[i].hash, 16) != 0) { |
354 return CRYPT_FAIL_TESTVECTOR; | 355 return CRYPT_FAIL_TESTVECTOR; |
355 } | 356 } |
356 } | 357 } |
357 return CRYPT_OK; | 358 return CRYPT_OK; |
358 #endif | 359 #endif |
361 #endif | 362 #endif |
362 | 363 |
363 | 364 |
364 | 365 |
365 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md5.c,v $ */ | 366 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md5.c,v $ */ |
366 /* $Revision: 1.5 $ */ | 367 /* $Revision: 1.8 $ */ |
367 /* $Date: 2005/05/23 02:42:07 $ */ | 368 /* $Date: 2006/11/01 09:28:17 $ */ |