[JAVA] AES security algorithm related - Why do I get different result values?
hello.
I’m trying to test the AES256 algorithm.
[1. Type of test]
- WEB SITE
- JAVA Program
[2. Test information]
- KEY : sdfhjiodfjisd231sdfhjiodfjisd231
- TEXT : ShVmYq3t6w9y$B&E
[3. Actual test results]
-
site1: https://aesencryption.net/
256bit /
output: USZet7l6QkYD/A9S5oIg+PbN/I7qRpWnkwqkKwWFS40= -
site2: An Online Tool for AES Encryption and Decryption
256bit/ECB
output: Fe+8zzw4vSJJ5qxdGWZSJkTEEBrlb7/NK4Kdt+y+2IQ= -
JAVA: Java AES Encryption Decryption Example - HowToDoInJava
256bit/ECB
output: IcApWVcdC2qIB58LDtrMaEG95F6Yt7uBmpdhUrx5XuE= -
JAVA: Java AES-256 Encryption and Decryption Examples
256bit/ECB
output : K5tWglkjfdF4MZPLfPfxbV/mNt9Ugd+2wWS3SMZCH98=
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Base64;
private static String secretKey = "sdfhjiodfjisd231sdfhjiodfjisd231";
String originalString = "ShVmYq3t6w9y$B&E";
void setup(){
size(500, 500);
println("-------------------------------");
println(originalString);
String encryptedString = AES.encrypt(originalString, secretKey);
String decryptedString = AES.decrypt(encryptedString, secretKey);
println(encryptedString);
println(decryptedString);
println("-------------------------------");
String encryptedString2 = AES256.encrypt(originalString);
String decryptedString2 = AES256.decrypt(encryptedString2);
System.out.println(originalString);
System.out.println(encryptedString2);
System.out.println(decryptedString2);
println("-------------------------------");
}
I don’t know why the results are different.
Anyone know? help me.