AES加解密
SecretKeySpec sks = null;
sks = new SecretKeySpec("a!)@diwo&xosidn!".getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] iv = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
IvParameterSpec ivSpec = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, sks,ivSpec);
byte[] re=cipher.doFinal("9".getBytes());
System.out.println("dddddddd "+re.toString() );
每次结果都不同。。。这是为啥~~~
------解决方案--------------------你打印的是re这个字节数组对象的内存地址当然每次结果不同了
你要打印他的内容Arrays.toString(re);用这个就看到了