|
300精币
- import javax.crypto.spec.SecretKeySpec;
- import javax.crypto.spec.IvParameterSpec;
- import javax.crypto.Cipher;
- public class HelloWorld {
- public static byte[] hexToByte(String hex){//字节集_十六进制到字节集
- int m = 0, n = 0;
- int byteLen = hex.length() / 2;
- byte[] ret = new byte[byteLen];
- for (int i = 0; i < byteLen; i++) {
- m = i * 2 + 1;
- n = m + 1;
- int intVal = Integer.decode("0x" + hex.substring(i * 2, m) + hex.substring(m, n));
- ret[i] = Byte.valueOf((byte)intVal);
- }
- return ret;
- }
- public static void main(String []args) {
- byte key[]=hexToByte("f5675cbb7e8887a705a4e6c94823d842bdea9abd51c84498c6484bc9592f41ff");;
- byte iv[]=hexToByte("f4e540360b85e9cd70330f50955ef83f");
- try {
- Cipher instance = Cipher.getInstance("AES/CFB/NoPadding");
- byte enc[]=hexToByte("ac16d2975c7d779ac43a81019f9ea0bcca9e7b82a60b71cc4bb747dc0e09afbc76e4aebae7fcb99c505ce60c7cdd564a44abaad762206f474697430e64c0c60ef8bfc51793efa78b99813311b7574f21f228514b2f886ad096d534e2761dec2367a65f49f674d6c9a3d81a31354043034dc464acbf591828b8e5fbef756494c96c7774ac20201aad2ff6ce8acb484600b00036916748e7ada4e3b5a166e69d61fb73e8913178757e7a8b2f5f9c38cbb937cea993cfb8ef99ab108699aaadacd17634faf5a2da648dc6f66d6373188b0fb0a86abfc171987f451888042e5b6a0405b35e2bce1bba9cf9212436d4c1efad8172e41e6b66a671bb8225a4508f59798c4e6331c2db32e680d6ff328a6560b4bf94647b65a2e16559c0c94ecc8935b3bb10bcabf2389d504a34317cc25f70c8c8ceb10396697dcfa0bf497d7921f369282551f1d80ee383eeadd32ec8c8d772ec0ca3734a0b0d1450192ddf6009326b5421ac633e969750a322a2a919613b336e6e523937e7821b5c458db41e828e7883e6e2264c2eb0882b824117072198f1aa7001f5");
- instance.init(2, new SecretKeySpec(key,"AES"), new IvParameterSpec(iv));
- String ret=new String(instance.doFinal(enc));
- System.out.println("解密后数据:"+ret);
- } catch (Exception e) {}
- }
- }
复制代码 上面是我用java写的一段完整的例子,在这上面粘贴就能运行得到结果的:https://c.runoob.com/compile/10
我用易语言解密出来就不对……有点怀疑是用到的模块有bug。
下午搞到现在,java复现都可以,易语言就是没搞定,搞得太心累了,特来求助
补充内容 (2020-9-11 03:08):
谁有加密解密的模块,源码,帮我测试下就好了,因为我怀疑是模块可能有bug。
帮我确定排除下这个问题。 |
|