source: trunk/include/sh_checksum.h@ 467

Last change on this file since 467 was 445, checked in by katerina, 11 years ago

Support for sha2-256 (ticket #348), part 2.

File size: 955 bytes
Line 
1#ifndef SH_CHECKSUM_H
2#define SH_CHECKSUM_H
3
4typedef unsigned char sha2_byte ;
5typedef UINT32 sha2_word32;
6typedef UINT64 sha2_word64;
7
8
9#define SHA256_BLOCK_LENGTH 64
10#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8)
11#define SHA256_DIGEST_LENGTH 32
12#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
13
14typedef struct _SHA256_CTX {
15 sha2_word32 state[8];
16 sha2_word64 bitcount;
17 sha2_byte buffer[SHA256_BLOCK_LENGTH];
18} SHA256_CTX;
19
20void SHA256_Init(SHA256_CTX *);
21void SHA256_Update(SHA256_CTX*, const sha2_byte*, size_t);
22void SHA256_Final(sha2_byte[SHA256_DIGEST_LENGTH], SHA256_CTX*);
23char* SHA256_End(SHA256_CTX*, char[KEYBUF_SIZE]);
24char* SHA256_Data(const sha2_byte*, size_t, char[KEYBUF_SIZE]);
25char* SHA256_Base2Hex(char * b64digest, char * hexdigest);
26char * SHA256_ReplaceBaseByHex(const char * str, char * before, char after);
27#endif
Note: See TracBrowser for help on using the repository browser.