【问题标题】:How can I get the same encrypted text?如何获得相同的加密文本?
【发布时间】:2015-03-25 04:47:05
【问题描述】:
String seedValue = "This Is MySecure";
String normalText = "Password";
normalTextEnc = AESHelper.encrypt(seedValue, normalText);
System.out.println("encrypt"+normalTextEnc);
当我再次运行此代码时,它会给我另一个加密文本。
我怎样才能得到相同的加密文本??
【问题讨论】:
标签:
android
encryption
passwords
password-encryption
【解决方案1】:
看看这个。 encrypt 函数将使用密码“key”加密消息“This is the MESSAGE”。然后我们在解密函数中使用相同的密码来解密加密的消息。您可以通过此链接了解更多信息。 https://trivedihardik.wordpress.com/tag/android-aes-example/
String encryptedData = AESHelper.encrypt("key", "This is the MESSAGE");
System.out.println("Encoded String " + encryptedData);
String decryptedData = AESHelper.decrypt("key", encryptedData);
System.out.println("Decoded String " + decryptedData);