comparison src/hashes/md2.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 md2.c 14 @param md2.c
29 6, 29 6,
30 30
31 &md2_init, 31 &md2_init,
32 &md2_process, 32 &md2_process,
33 &md2_done, 33 &md2_done,
34 &md2_test 34 &md2_test,
35 NULL
35 }; 36 };
36 37
37 static const unsigned char PI_SUBST[256] = { 38 static const unsigned char PI_SUBST[256] = {
38 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 39 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6,
39 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 40 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188,
232 233
233 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { 234 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
234 md2_init(&md); 235 md2_init(&md);
235 md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); 236 md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
236 md2_done(&md, buf); 237 md2_done(&md, buf);
237 if (memcmp(buf, tests[i].md, 16) != 0) { 238 if (XMEMCMP(buf, tests[i].md, 16) != 0) {
238 return CRYPT_FAIL_TESTVECTOR; 239 return CRYPT_FAIL_TESTVECTOR;
239 } 240 }
240 } 241 }
241 return CRYPT_OK; 242 return CRYPT_OK;
242 #endif 243 #endif
244 245
245 #endif 246 #endif
246 247
247 248
248 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */ 249 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */
249 /* $Revision: 1.5 $ */ 250 /* $Revision: 1.8 $ */
250 /* $Date: 2005/05/23 02:42:07 $ */ 251 /* $Date: 2006/11/01 09:28:17 $ */