#define SM3_H
#ifndef DWORD
typedef unsigned long DWORD;
#endif
#ifndef BYTE
typedef unsigned char BYTE;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void SM3_Init();
void SM3_Update(BYTE *message, DWORD length);
void SM3_Final_dword(DWORD *out_hash);
void SM3_Final_byte(BYTE *out_hash);
void SM3_Final(DWORD *out_hash);
/*
* output = SM3( input buffer )
*/
void sm3( unsigned char *input, long ilen,
unsigned char output[32] );
#ifdef __cplusplus
}
#endif
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sm3.h"
#define INFO 0
static unsigned long long total_length = 0;
static BYTE message_buffer[64] = {0};
static DWORD message_buffer_position = 0;
static DWORD hash[8