嘗試了github上的https://github.com/brix/crypto-js
學了用npm安裝包https://www.runoob.com/nodejs/nodejs-npm.html
看了好多遍README.md
搞得心力憔悴,兩三個小時,就是不能跑。最后找到這篇博客https://blog.csdn.net/weixin_43953753/article/details/86018134,一下子解決了。
總之,在你的html文件里直接加上下面這行代碼
<script src="https://cdn.bootcss.com/crypto-js/3.1.9-1/crypto-js.min.js"></script>
然后就可以快樂地使用crypto-js內置的各種加密算法了。