Node crypto - unable to reverse encryption

Viewed 1731

Why does this not print "hello"?

var cipher = crypto.createCipheriv('rc4', 'secret', '');
crypt = cipher.update('hello', 'binary', 'utf8');
crypt += cipher.final('utf8');

var decipher = crypto.createDecipheriv('rc4','secret', '');
data = decipher.update(crypt, 'binary', 'utf8');
data += decipher.final('utf8');

console.log(data); // prints e/l
2 Answers
Related