On 29 May 2012 18:57, mscdex <[email protected]> wrote:
> On May 29, 12:15 pm, James Coglan <[email protected]> wrote:
> > Can someone explain why the outputs are different? I'm trying make
> > something that's portable between the server and the client, so need to
> > pick a library I can rely on for consistent output.
>
> It seems the crypto.pbkdf2() in node is returning a binary string
> instead of a Buffer. Try this: (new Buffer(key1,
> 'binary')).toString('hex')
Ah, these produce the same output:
console.log('CryptoJS', CryptoJS.PBKDF2('foo', 'salt', {keySize: 16,
iterations: 1}).toString());
crypto.pbkdf2('foo', 'salt', 1, 16*4, function(error, key1) {
console.log('Node', new Buffer(key1, 'binary').toString('hex'));
});
Presumably with the plans to remove binary strings from Node, pbkdf2() will
eventuall yield a Buffer so I'd just call key1.toString('hex'), right?
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en