我有用于加密的java代码
public String encrypt() throws Exception {
String data = "Hello World";
String secretKey = "j3u8ue8xmrhsth59";
byte[] keyValue = secretKey.getBytes();
Key key = new SecretKeySpec(keyValue, "AES");
Cipher c = Cipher.getInstance("AES");
c.init(Cipher.ENCRYPT_MODE, key);
byte[] encVal = c.doFinal(StringUtils.getBytesUtf8(data));
String encryptedValue = Base64.encodeBase64String(encVal);
return encryptedValue;
}
它返回与此处的工具相同的值( eg5pK6F867tyDhBdfRkJuA== )

我将代码转换为 Nodejs(加密)
var crypto = require('crypto')
encrypt(){
var data = "Hello World"
var cipher = crypto.createCipher('aes-128-ecb','j3u8ue8xmrhsth59')
var crypted = cipher.update(data,'utf-8','base64')
crypted += cipher.final('base64')
return crypted;
}
但这给出了不同的值( POixVcNnBs3c8mwM0lcasQ== )
如何从两者中获得相同的价值?我错过了什么?