1
If you need the code to decrypt the algorithm is here JAVA
如果你需要代碼解密算法就在這里JAVA
public static String aes_decrypt(String passwordhex, String strKey) throws Exception {
try {
byte[] keyBytes = Arrays.copyOf(strKey.getBytes("ASCII"), 16);
SecretKey key = new SecretKeySpec(keyBytes, "AES");
Cipher decipher = Cipher.getInstance("AES");
decipher.init(Cipher.DECRYPT_MODE, key);
char[] cleartext = passwordhex.toCharArray();
byte[] decodeHex = Hex.decodeHex(cleartext);
byte[] ciphertextBytes = decipher.doFinal(decodeHex);
return new String(ciphertextBytes);
} catch (Exception e) {
e.getMessage();
}
return null;
}
It received a standard hex format string but variable and returns the password. Test with those in main method
它收到一個標准的十六進制格式字符串但變量並返回密碼。用主方法測試
System.out.println(aes_encrypt("your_string_password", "your_string_key"));
System.out.println(aes_decrypt("standard_hex_format_string ", "your_string_key"));
firstable test only with encrypt, then just with decrypt. By the way you must install 'commons-codec-1.6.jar' so you can use the Hex class http://commons.apache.org/proper/commons-codec/download_codec.cgi
只有加密才能進行第一次測試,然后只需要解密。順便說一下,你必須安裝'commons-codec-1.6.jar',這樣你才能使用Hex類http://commons.apache.org/proper/commons-codec/download_codec.cgi
Greetings from Ecuador, Ibarra
來自厄瓜多爾的問候,Ibarra