关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。
想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。
4年前关闭。
Improve this question
我需要将安全信息存储在 AsyncStorage ,
所以请任何人解释如何在 react native 中加密和解密文本
最佳答案
你可以使用crypto-js库https://github.com/brix/crypto-js .在 React Native 应用程序中工作正常。
npm install crypto-js --save
var CryptoJS = require("crypto-js");
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123');
console.log("encrypted text", ciphertext.toString());
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123');
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
console.log("decrypted text", plaintext);
关于react-native - 如何在 native react 中加密和解密文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42826782/