언어 간의 차이를 일으키는 원인을 파악할 수 없습니다. 자바에서 나는이 :Java에서 Node.js로 Blowfish ECB를 사용하여 암호 해독 코드를 변환 할 수 없습니다.
이byte[] buf = Base64.getDecoder().decode("AutMdzthDvPlE+UnhcHa2h4UZGPdme7t");
System.out.println(buf.length);
String key = "" + 2270457870L;
byte[] keyBytes = key.getBytes("UTF8");
System.out.println(keyBytes.length);
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyBytes, "Blowfish"));
byte[] newBytes = cipher.doFinal(buf);
System.out.println(newBytes.length);
System.out.println(Arrays.toString(newBytes));
나는이 점을 설정 노드에서 (http://ideone.com/0dXuJL에서 실행 가능한 온라인) 다음
: (https://tonicdev.com/paulbgd/57b66c8ea0630d1400081ad0에서 실행 가능한 온라인)
const buf = Buffer.from("AutMdzthDvPlE+UnhcHa2h4UZGPdme7t");
console.log(buf.length);
const keyBytes = Buffer.from('2270457870', 'utf8');
console.log(keyBytes.length);
const decipher = require('crypto').createDecipher('bf-ecb', keyBytes);
const buffers = [];
buffers.push(decipher.update(buf));
buffers.push(decipher.final());
const newBytes = Buffer.concat(buffers);
console.log(newBytes.length);
console.log(newBytes);
이
를 출력한다 오류 : error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
은 64 기수 난 그냥 실수 그것을 복사 할 때 만들었지 만 createDecipher가 암호를 기다리고 있다는 것을 몰랐습니다! 엄청 고마워. – PaulBGD