visionmedia/express — pull request #1571 by jlubawy (2013-04-05 06:56:42+00:00)
Title: Change to crypto.pbkdf2 in Node v0.10 broke auth example

The function ```crypto.pbkdf2``` has changed from returning a String in Node v0.8 to a SlowBuffer in Node v0.10 (https://github.com/joyent/node/issues/5003) effectively breaking the authentication scheme used in the auth example (not to mention https://github.com/visionmedia/node-pwd).

The change causes the line ```if (hash == user.hash) return fn(null, user);``` in the app.js ```authentication``` function to always evaluate as ```false``` using Node v0.10 (https://github.com/visionmedia/express/issues/1559).

Using the recommendations from (https://github.com/joyent/node/issues/5003) I modified the hash function in pass.js to return a base64 encoded hash at all times fixing the issue using Node v0.10 and not breaking the example using Node v0.8 (tested both).