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