Node.js crypto module crash on Amazon AMI instance

159 views Asked by At

I'm stuck on a issue with crypto module of node.js in my production instance of my app,

When I use "pbkdf2Sync" function in an Amazon instance, it's works terrible and for the same sets of values returns different values.

I make a little script to see the problem:

var crypto = require('crypto');
var len = 128;
var iterations = 12000;
console.log(new Buffer(crypto.pbkdf2Sync('lalala','lalala', iterations, len), 'binary').toString('base64'));
console.log(new Buffer(crypto.pbkdf2Sync('lalala','lalala', iterations, len), 'binary').toString('base64'));

On my development machine returns (A MacBook Air):

g3hfqNL+32Z8HfkF+2o/x1IT4HclmpBB4VeYEt+9k7gaN+HO4J3vwIyMMcPej21KkGuBvAbjjsw5N4kWZEHA/Dq8yL3P5lPwHTCzt+MVJcSA85MrjMY72SHU7TGLpXAzHhkE6S+xNRlL/4fGQu9oBgAvAIP7ar/JOj1y3tAghP4=    
g3hfqNL+32Z8HfkF+2o/x1IT4HclmpBB4VeYEt+9k7gaN+HO4J3vwIyMMcPej21KkGuBvAbjjsw5N4kWZEHA/Dq8yL3P5lPwHTCzt+MVJcSA85MrjMY72SHU7TGLpXAzHhkE6S+xNRlL/4fGQu9oBgAvAIP7ar/JOj1y3tAghP4=

But in production machine (Amazon EC2-medium instance):

AAAHAAAAAQAAAAAAAAAAAAAAoK3iaSkVAAAAAAAAAQAAADlBcJs9DQAAAAAAAAEAAABZcvIWqQAAAKCiMgL/fwAAAAAAAAAAAADIojIC/38AAAAAAAAHAAAAOXPyFqkAAAAQozIC/38AAEIL5GkpFQAAAAAAAAAAAABhIQAAAAA=    
yAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAConjIC/38AAABiyQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPBdyQIAAAAAAAA=

I don't know why this happens, it's a bug of node.js crypto module?

0

There are 0 answers