2015-03-25 56 views
0
String seedValue = "This Is MySecure"; 

String normalText = "Password"; 

normalTextEnc = AESHelper.encrypt(seedValue, normalText); 

System.out.println("encrypt"+normalTextEnc); 

当我再次运行此代码时,它给了我另一个加密文本。 我怎样才能得到相同的加密文本?如何获得相同的加密文本?

+0

见http://stackoverflow.com/questions/24701068/what-makes-aes-with-base64-generate-different-encryption-result-for-the-same-pla – squeeish 2015-03-25 05:03:01

回答

0

看看这个。加密功能将用密码“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);