# 哈希函数

# 说明

SDK中提供的哈希函数,用于计算数据的哈希值,支持多种常见的哈希算法。

# 如何使用

// 使用MD5算法计算哈希
const char* md5Result = md5_hash("Hello World");

// 使用SHA256算法计算哈希
const char* sha256Result = sha256_hash("Hello World");

// 使用FNV-1a算法计算哈希
uint32_t fnv1aResult = fnv1a_hash("Hello World");

# md5_hash

char* md5_hash(const char* input)

计算输入字符串的MD5哈希值。

参数名字 参数类型 描述
input const char* 需要计算哈希值的输入字符串
const char* hash = md5_hash("Hello World");

# sha256_hash

char* sha256_hash(const char* input)

计算输入字符串的SHA256哈希值。

参数名字 参数类型 描述
input const char* 需要计算哈希值的输入字符串
const char* hash = sha256_hash("Hello World");

# fnv1a_hash

uint32_t fnv1a_hash(const char* input)

使用FNV-1a算法计算字符串的哈希值,适用于快速哈希计算。

参数名字 参数类型 描述
input const char* 需要计算哈希值的输入字符串
uint32_t hash = fnv1a_hash("Hello World");