在 React 中使用 crypto-js
Using crypto-js in React
我使用 create-react-app
生成了一个应用程序,我想使用
crypto-js
我收到以下错误
crypto.sha256() is not a function
你必须使用
安装 crypto-js
npm install crypto-js
在你的 js 文件中,你必须导入你想使用的模块
import sha256 from 'crypto-js/sha256';
现在你可以使用这些功能了
sha256(nonce + message);
在此之前您已经定义了 message
和 nonce
我使用 create-react-app
生成了一个应用程序,我想使用
crypto-js
我收到以下错误
crypto.sha256() is not a function
你必须使用
安装 crypto-jsnpm install crypto-js
在你的 js 文件中,你必须导入你想使用的模块
import sha256 from 'crypto-js/sha256';
现在你可以使用这些功能了
sha256(nonce + message);
在此之前您已经定义了 message
和 nonce