Files
GmSSL/crypto/sm3/sm3.h
Zhi Guan 3bdc0ea895 update
2015-08-15 15:02:15 +08:00

34 lines
698 B
C

#ifndef HEADER_SM3_H
#define HEADER_SM3_H
#define SM3_DIGEST_LENGTH 32
#define SM3_BLOCK_SIZE 64
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint32_t digest[8];
int nblocks;
unsigned char block[64];
int num;
} sm3_ctx_t;
int sm3_init(sm3_ctx_t *ctx);
int sm3_update(sm3_ctx_t *ctx, const unsigned char* data, size_t data_len);
int sm3_final(sm3_ctx_t *ctx, unsigned char digest[SM3_DIGEST_LENGTH]);
void sm3_compress(uint32_t digest[8], const unsigned char block[SM3_BLOCK_SIZE]);
void sm3(const unsigned char *data, size_t datalen, unsigned char digest[SM3_DIGEST_LENGTH]);
#ifdef __cplusplus
}
#endif
#endif