rtc_base message_digest
实现了多种类型的消息摘要算法,DIGEST_MD5、DIGEST_SHA_1、DIGEST_SHA_224、DIGEST_SHA_256、DIGEST_SHA_384、DIGEST_SHA_512[];
MD5:
MD5信息摘要算法(英语:MD5 Message-Digest Algorithm),一种被广泛使用的密码散列函数,可以产生出一个128位(16字节)的散列值(hash value),用于确保信息传输完整一致。
inline std::string MD5(const std::string& input) {
return ComputeDigest(DIGEST_MD5, input);
}
std::string HA1 = MD5(sensitive);
ExplicitZeroMemory(sensitive, len);
delete[] sensitive;
std::string HA2 = MD5(A2);
std::string dig_response = MD5(HA1 + ":" + middle + ":" + HA2);
HMAC是密钥相关的哈希运算消息认证码(Hash-based Message Authentication Code)的缩写
使用:
size_t ret = rtc::ComputeHmac(rtc::DIGEST_SHA_1, key, keylen, buf.Data(),
msg_len_for_hmac