字符串用react 用sha256加密


1、npm install crypto-js

然后在项目中引入sha256

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

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

 

 

 

posted @ 2020-10-16 16:08  AloneInDefeat  阅读(1341)  评论(0编辑  收藏  举报