1

From this post: What's wrong with nodejs crypto decipher? I figured out that to make my code work I need to encrypt my data with the openSSL -nosalt option beacuase of the way the node.js crypto library works. Since I am using the Node.js crypto library to encrypt, I need to know how to encrypt the data with the -nosalt option. Also I am using the openSSL aes256 algorithm.

Thanks,
Ari

Community
  • 1
  • 1
Ari Porad
  • 2,834
  • 3
  • 33
  • 51
  • Please add more details to your question, do not assume that people will do read other answers to help you. If you write bad questions, people will just downvote you and not answer. – loganfsmyth Feb 16 '13 at 03:19

1 Answers1

2

The linked question has how to decrypt:

var crypto=require('crypto')
var cipher=crypto.createDecipher('aes-256-cbc', "password")
var enc = cipher.update("Mh5yxIyZH+fSMTkSgkLa5w==", 'base64', 'utf8')
enc += cipher.final('utf8')

Encrypting is literally the exact opposite.

var crypto=require('crypto')
var cipher=crypto.createCipher('aes-256-cbc', "password")
var enc = cipher.update("owlstead\n", 'binary', 'base64')
enc += cipher.final('base64')
loganfsmyth
  • 156,129
  • 30
  • 331
  • 251
  • @AriPorad Ah, sorry misread. Even more reason to put more info in your question then. It should stand on its own. Please fix it. – loganfsmyth Feb 16 '13 at 03:29