34 lines
686 B
C
34 lines
686 B
C
#include "SfTypeDefine.h"
|
|
|
|
#define SHA256_HASH_SIZE 32
|
|
|
|
/* Hash size in 32-bit words */
|
|
#define SHA256_HASH_WORDS 8
|
|
|
|
struct _SHA256Context {
|
|
unsigned long long totalLength;
|
|
UINT32 hash[SHA256_HASH_WORDS];
|
|
UINT32 bufferLength;
|
|
union {
|
|
UINT32 words[16];
|
|
UINT8 bytes[64];
|
|
} buffer;
|
|
#ifdef RUNTIME_ENDIAN
|
|
int littleEndian;
|
|
#endif /* RUNTIME_ENDIAN */
|
|
};
|
|
|
|
typedef struct _SHA256Context SHA256Context;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void SHA256Init (SHA256Context *sc);
|
|
void SHA256Update (SHA256Context *sc, const void *data, UINT32 len);
|
|
void SHA256Final (SHA256Context *sc, UINT8 hash[SHA256_HASH_SIZE]);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|