-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto.pbkdf2Sync return different result that 7 node #18075
Comments
$ nvm use 7.10
Now using node v7.10.1 (npm v4.2.0)
$ node
> crypto.pbkdf2Sync('!Q@W#E$R%T', 'foobar', 233, 512, 'SHA1').toString('hex')
'126c9475b641a0c4ceaff5c94a0a47e974636f9499c04cded88c066997f6125a0fd483b24a89e504dbf2c649e997d1bd0337e9b2eca7144abca2defc36053c36fd74bf8d46fa7f1b9e5cde035b1d45c35f6410936ce9ec70c3826a9d6a12c89faeb20f90abf0a2f658ad59ea1499157a5673b24bb293abefbae6593a7c968331d01f282376c1a2cc2b0d9ec026aa10f271d3a1ed93352c4bd528a8dbf8dfd82b52e5f8e96638f8c13d8674975a8b9674f86a0f7792f6ea56ceaa064c8b63fc4e22f6c832fb2ea5e43b1b14d78d7605b705ec7558e460a2a83807bd00cd31b8b8083d30e63234d879cbb5a886a7c03959ba81f9d76fa69b4cb9cf4bb79298aba5b1b0161abde5eb1e1185bbb1c09eacf8546817883bfbcc549b2cb0ab7a2ad5cc4b1bdb32f3f37f80208dcf47a76a7835c93578f4523ac06bc59d64a41946fe679e09308f0e0d15a03a71c43bbee2024be4f0553e4aedee8927316a2d7640b78358b1e4246e65dbf9fbe50799beb987f4bfa89dcad057a00ca0960b9306d2ad8dc4245694aa2176397e4600b100e0a663b5a4e89af68db16208cea3477ba8a76657bcf1beff5eaa05f608f6ac57e270d470ac2830e2ac6cecdb78ea476bdce368116217879e77f9d900fb1a13b1171bef53fcb1209e0a5311ca34a83955d4cbc11b1fe86b49788965437a75f10cb7d36d2ce8387ce4c171961aa192510eabefbb'
>
$ nvm use 8.9
Now using node v8.9.1 (npm v5.5.1)
$ node
> crypto.pbkdf2Sync('!Q@W#E$R%T', 'foobar', 233, 512, 'SHA1').toString('hex')
'126c9475b641a0c4ceaff5c94a0a47e974636f9499c04cded88c066997f6125a0fd483b24a89e504dbf2c649e997d1bd0337e9b2eca7144abca2defc36053c36fd74bf8d46fa7f1b9e5cde035b1d45c35f6410936ce9ec70c3826a9d6a12c89faeb20f90abf0a2f658ad59ea1499157a5673b24bb293abefbae6593a7c968331d01f282376c1a2cc2b0d9ec026aa10f271d3a1ed93352c4bd528a8dbf8dfd82b52e5f8e96638f8c13d8674975a8b9674f86a0f7792f6ea56ceaa064c8b63fc4e22f6c832fb2ea5e43b1b14d78d7605b705ec7558e460a2a83807bd00cd31b8b8083d30e63234d879cbb5a886a7c03959ba81f9d76fa69b4cb9cf4bb79298aba5b1b0161abde5eb1e1185bbb1c09eacf8546817883bfbcc549b2cb0ab7a2ad5cc4b1bdb32f3f37f80208dcf47a76a7835c93578f4523ac06bc59d64a41946fe679e09308f0e0d15a03a71c43bbee2024be4f0553e4aedee8927316a2d7640b78358b1e4246e65dbf9fbe50799beb987f4bfa89dcad057a00ca0960b9306d2ad8dc4245694aa2176397e4600b100e0a663b5a4e89af68db16208cea3477ba8a76657bcf1beff5eaa05f608f6ac57e270d470ac2830e2ac6cecdb78ea476bdce368116217879e77f9d900fb1a13b1171bef53fcb1209e0a5311ca34a83955d4cbc11b1fe86b49788965437a75f10cb7d36d2ce8387ce4c171961aa192510eabefbb'
> I am not aware of any changes that would break that code. It would be helpful if you could provide a complete piece of code that produces different results on these versions. (e.g. the |
@addaleax File |
@addaleax You can generate data (generate in node 6): const crypto = require('crypto');
const password = '!Q@W#E$R%T';
const salt = '!@#$%^&*()_}{POIUYTREWQ';
require('fs').writeFileSync('dump.json', JSON.stringify([{
hash: crypto.pbkdf2Sync(password, salt, 233, 512, 'SHA1').toString(),
salt
}])); |
These parts are broken. The return value of When you call What changed from Node 7 to Node 8 is that the JS engine now accumulates multiple If you want to store binary data, like the I’m closing this since it’s not a bug inside Node itself. If you have similar issues or have more questions about this, https://github.com/nodejs/help is a good place to start. |
crypto.pbkdf2Sync in node version 8.9 returns different result than in 7.10 node versions (current situations not equal with #7464)
it
oldHash.compare(newHash)
return 0 in node 6 and node 7, but node 8 return 1. Why? What am I doing wrong? )The text was updated successfully, but these errors were encountered: