Node.js cypher和OpenSSL不同

时间:2012-02-13 03:11:59

标签: node.js encryption openssl aes

Nodejs代码

var crypto = require("crypto");
var cypher = crypto.createCipher("aes192", "pass");
var out = cypher.update("TEST1","utf8", "binary");
out += cypher.final("binary");
console.log(out);

NODE OUTPUT:

´_ËT~R  dE{

命令行:

echo -n "TEST1" | openssl enc -aes192    

CLI OUTPUT:

Salted__?
????X-N??R?*a8  P9?t%      

我做错了什么?

PD:是的,我知道这些是二进制输出,但它们显然不匹配。

1 个答案:

答案 0 :(得分:1)

你错过了openssl的-nosalt标志。