字符串用react 用sha256加密


1、npm install crypto-js

然后在项目中引入sha256

2、import sha256 from 'crypto-js/sha256';

然后将想要转换的字符 加密
3、
const hashDigest = sha256("我和我的祖国").toString();
console.log("我和我的祖国",hashDigest)
实现效果

 

原文地址:https://www.cnblogs.com/aloneindefeat/p/13827016.html