comparison libtomcrypt/src/hashes/md2.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 @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 $ */