JWT & HMAC-SHA256
JWT
JSON Web Tokens
https://en.wikipedia.org/wiki/JSON_Web_Token#Structure
HMACSHA256
https://en.wikipedia.org/wiki/HMAC
keyed-hash message authentication code or hash-based message authentication code
密钥哈希消息认证码或基于哈希的消息认证码
https://www.freeformatter.com/hmac-generator.html
http://convertstring.com/Hash/SHA256
HMAC-SHA256(key, data) & SHA256(key + data)
https://stackoverflow.com/questions/11415055/how-to-use-hmac-sha256
Javascript HMAC SHA256
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/hmac-sha256.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/enc-base64.min.js"></script>
<script>
var hash = CryptoJS.HmacSHA256("Message", "secret");
var hashInBase64 = CryptoJS.enc.Base64.stringify(hash);
document.write(hashInBase64);
</script>
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/9712897.html
未经授权禁止转载,违者必究!