comparison src/hashes/sha2/sha512.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 sha512.c 14 @param sha512.c
29 9, 29 9,
30 30
31 &sha512_init, 31 &sha512_init,
32 &sha512_process, 32 &sha512_process,
33 &sha512_done, 33 &sha512_done,
34 &sha512_test 34 &sha512_test,
35 NULL
35 }; 36 };
36 37
37 /* the K array */ 38 /* the K array */
38 static const ulong64 K[80] = { 39 static const ulong64 K[80] = {
39 CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), 40 CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd),
294 295
295 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { 296 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
296 sha512_init(&md); 297 sha512_init(&md);
297 sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); 298 sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
298 sha512_done(&md, tmp); 299 sha512_done(&md, tmp);
299 if (memcmp(tmp, tests[i].hash, 64) != 0) { 300 if (XMEMCMP(tmp, tests[i].hash, 64) != 0) {
300 return CRYPT_FAIL_TESTVECTOR; 301 return CRYPT_FAIL_TESTVECTOR;
301 } 302 }
302 } 303 }
303 return CRYPT_OK; 304 return CRYPT_OK;
304 #endif 305 #endif
312 313
313 314
314 315
315 316
316 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */ 317 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */
317 /* $Revision: 1.5 $ */ 318 /* $Revision: 1.8 $ */
318 /* $Date: 2005/05/23 02:42:07 $ */ 319 /* $Date: 2006/11/01 09:28:17 $ */