35 lines
865 B
C
35 lines
865 B
C
#ifndef SHA3X_H
|
||
#define SHA3X_H
|
||
|
||
#include <stdint.h>
|
||
#include <stddef.h>
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/**
|
||
* SHA3-256哈希函数
|
||
* @param out 输出缓冲区,用于存储32字节的哈希结果
|
||
* @param outlen 输出长度,必须小于等于32
|
||
* @param in 输入数据
|
||
* @param inlen 输入数据长度
|
||
* @return 0表示成功,-1表示失败
|
||
*/
|
||
int sha3_256(uint8_t* out, size_t outlen, const uint8_t* in, size_t inlen);
|
||
|
||
/**
|
||
* SHA3X三重哈希函数(Tari项目中的SHA3X算法)
|
||
* @param out 输出缓冲区,用于存储32字节的哈希结果
|
||
* @param outlen 输出长度,必须小于等于32
|
||
* @param in 输入数据
|
||
* @param inlen 输入数据长度
|
||
* @return 0表示成功,-1表示失败
|
||
*/
|
||
int sha3x_hash(uint8_t* out, size_t outlen, const uint8_t* in, size_t inlen);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif // SHA3X_H
|