js哈希256加密示例
代码示例如下
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/core.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/sha256.js"></script>
<script>
const data = '😀🐢小可爱';
const hash = CryptoJS.SHA256(data).toString();
console.log(hash);
</script>
</body>
</html>
备注:亲测可行,和php加密出的效果一致
版权声明:
作者:admin
链接:http://blog.mryxh.cn/3297.html
文章版权归作者所有,未经允许请勿转载。
THE END