xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

JWT & HMAC-SHA256

JWT

JSON Web Tokens

https://jwt.io/

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


https://security.stackexchange.com/questions/79577/whats-the-difference-between-hmac-sha256key-data-and-sha256key-data

HMAC-SHA256(key, data) & SHA256(key + data)

https://stackoverflow.com/questions/11415055/how-to-use-hmac-sha256

Javascript HMAC SHA256

https://www.jokecamp.com/blog/examples-of-creating-base64-hashes-using-hmac-sha256-in-different-languages/


<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 发布文章使用:只允许注册用户才可以访问!


posted @ 2018-09-27 14:31  xgqfrms  阅读(583)  评论(9编辑  收藏  举报