2015-03-25 36 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); 
相關問題