所以我有一个关于河豚解密的python2 impl:
from Crypto.Cipher import Blowfish
decodee = '1234'
key = 'oY3[r.Ri4oF'
IV = '\x00\x00\x00\x00\x00\x00\x00\x00'
res = Blowfish.new(key=key, mode=Blowfish.MODE_CFB, IV=IV).decrypt(decodee)
print len(res), map(ord, list(res))
带输出
4 [124, 91, 187, 19]
我试图将它像这样移植到java:
String decodee = "1234";
String key = "oY3[r.Ri4oF";
String iv = "\0\0\0\0\0\0\0\0";
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "Blowfish");
IvParameterSpec ivSpec = new IvParameterSpec(iv.getBytes());
Cipher cipher = Cipher.getInstance("Blowfish/CFB/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
byte[] res = cipher.doFinal(decodee.getBytes());
String s = new String(res);
int[] x = new int[s.length()]; for (int i = 0 ; i < s.length() ; i++) x[i] = (int) s.charAt(i);
System.out.println(Arrays.toString(x));
但它显示:
4 [124, 242, 10, 112]
如何使它等于?