当前位置:网站首页>Encapsulation of practical methods introduced by webrtc native M96 basic base module (MD5, Base64, time, random number)

Encapsulation of practical methods introduced by webrtc native M96 basic base module (MD5, Base64, time, random number)

2022-06-25 11:46:00 Crossing the river with a reed 694

rtc_base message_digest

Implements many types of message summarization algorithms ,DIGEST_MD5、DIGEST_SHA_1、DIGEST_SHA_224、DIGEST_SHA_256、DIGEST_SHA_384、DIGEST_SHA_512[];
MD5:
MD5 Information digest algorithm ( English :MD5 Message-Digest Algorithm), A widely used cryptographic hash function , I can produce one 128 position (16 byte ) Hash value (hash value), Used to ensure complete and consistent transmission of information .

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 Is the key related hash operation message authentication code (Hash-based Message Authentication Code) Abbreviation
Use :

  size_t ret = rtc::ComputeHmac(rtc::DIGEST_SHA_1, key, keylen, buf.Data(),
                                msg_len_for_hmac
原网站

版权声明
本文为[Crossing the river with a reed 694]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251143555542.html