comparison src/hashes/sha1.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 @file sha1.c 14 @file sha1.c
30 6, 30 6,
31 31
32 &sha1_init, 32 &sha1_init,
33 &sha1_process, 33 &sha1_process,
34 &sha1_done, 34 &sha1_done,
35 &sha1_test 35 &sha1_test,
36 NULL
36 }; 37 };
37 38
38 #define F0(x,y,z) (z ^ (x & (y ^ z))) 39 #define F0(x,y,z) (z ^ (x & (y ^ z)))
39 #define F1(x,y,z) (x ^ y ^ z) 40 #define F1(x,y,z) (x ^ y ^ z)
40 #define F2(x,y,z) ((x & y) | (z & (x | y))) 41 #define F2(x,y,z) ((x & y) | (z & (x | y)))
268 269
269 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { 270 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
270 sha1_init(&md); 271 sha1_init(&md);
271 sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); 272 sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
272 sha1_done(&md, tmp); 273 sha1_done(&md, tmp);
273 if (memcmp(tmp, tests[i].hash, 20) != 0) { 274 if (XMEMCMP(tmp, tests[i].hash, 20) != 0) {
274 return CRYPT_FAIL_TESTVECTOR; 275 return CRYPT_FAIL_TESTVECTOR;
275 } 276 }
276 } 277 }
277 return CRYPT_OK; 278 return CRYPT_OK;
278 #endif 279 #endif
281 #endif 282 #endif
282 283
283 284
284 285
285 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha1.c,v $ */ 286 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha1.c,v $ */
286 /* $Revision: 1.5 $ */ 287 /* $Revision: 1.8 $ */
287 /* $Date: 2005/05/23 02:42:07 $ */ 288 /* $Date: 2006/11/01 09:28:17 $ */