Skip to content

Instantly share code, notes, and snippets.

@virtuo
virtuo / gist:757317
Created December 28, 2010 15:20
Problem using crypto with base64 ouput format
var crypto = require('crypto');
var key = "some key";
var msg = "Attack Troy from within a wooden horse!";
var CYPHER = "aes256";
var test = function(output_encoding) {
var cypher = crypto.createCipher(CYPHER, key);
var enc_msg = cypher.update(msg, "utf8", output_encoding);
enc_msg += cypher.final(output_encoding);