{"_id":"node-php-password","_rev":"8-d6b2493fed6b018f475260198e8ea3e1","name":"node-php-password","description":"A node compatibility layer to verify and hash php compatible password hashes","dist-tags":{"latest":"0.1.2"},"versions":{"0.0.1":{"name":"node-php-password","version":"0.0.1","description":"A node compatibility layer to verify and hash php compatible password hashes","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Thomas Alrek","email":"thomas@alrek.no"},"license":"ISC","dependencies":{"bcryptjs":"^2.3.0","glob":"^7.0.5"},"aliases":{"PASSWORD_DEFAULT":"PASSWORD_BCRYPT"},"gitHead":"a0a55ce5ece7019b0a11d8b6d7b401caf7dd1222","_id":"node-php-password@0.0.1","_shasum":"6a69ef1b263663991bb3a76ef713a286cfe686b0","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"alrek-consulting","email":"thomas@alrek.no"},"dist":{"shasum":"6a69ef1b263663991bb3a76ef713a286cfe686b0","tarball":"https://registry.npmjs.org/node-php-password/-/node-php-password-0.0.1.tgz","integrity":"sha512-CynzxDkaHSnKEgkdAyPdLEmn9KpoG/qxqRYXVjqT2Y4sLNXd08iRnGSk9TrKnQfb5McLraXQHkwV2MVGowR+2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICzXoJg0DScVZeMnNxQ9drvb7Jwvg8ZjkycQKoKeu4d7AiEAjH07Y2+Yx+Ov1IYaQ+aSWkMZ8yRlc857yRTUxmo6pT8="}]},"maintainers":[{"name":"alrek-consulting","email":"thomas@alrek.no"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/node-php-password-0.0.1.tgz_1467580330095_0.09602640150114894"}},"0.1.0":{"name":"node-php-password","version":"0.1.0","description":"A node compatibility layer to verify and hash php compatible password hashes","main":"index.js","repository":{"type":"git","url":"git+https://github.com/alrek-consulting/node-php-password.git"},"keywords":["php","password","security","bcrypt","hash"],"scripts":{"test":"mocha --reporter spec test"},"author":{"name":"Thomas Alrek","email":"thomas@alrek.no"},"license":"GPL-2.0","bugs":{"url":"https://github.com/alrek-consulting/node-php-password/issues"},"homepage":"https://github.com/alrek-consulting/node-php-password#readme","dependencies":{"bcryptjs":"^2.3.0","glob":"^7.0.5"},"devDependencies":{"mocha":"^2.4.5","chai":"^3.5.0"},"aliases":{"PASSWORD_DEFAULT":"PASSWORD_BCRYPT"},"gitHead":"49d267f3594e129c0b0aef22983d3124f1fef6cb","_id":"node-php-password@0.1.0","_shasum":"dbcea65a35b037d514ed3aa935733c019cd1124d","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"alrek-consulting","email":"thomas@alrek.no"},"dist":{"shasum":"dbcea65a35b037d514ed3aa935733c019cd1124d","tarball":"https://registry.npmjs.org/node-php-password/-/node-php-password-0.1.0.tgz","integrity":"sha512-YWpwHZhMC4hDyy62GNLK/3IBB/yNDg154AAX/It5zUfd6X839lIRTIXwQtglXNDo/ZOapIcYhU1/3ADp83XpYw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1FrZk9HYOPxYgtiT3AZUQvvlLdbDs6vzMKc6g9wTH9AIhAI2syQfqc+d5xyLQ4542LogjCYxyVLrccPZC6/wlvh+7"}]},"maintainers":[{"name":"alrek-consulting","email":"thomas@alrek.no"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/node-php-password-0.1.0.tgz_1467635939918_0.333027919055894"}},"0.1.1":{"name":"node-php-password","version":"0.1.1","description":"A node compatibility layer to verify and hash php compatible password hashes","main":"index.js","repository":{"type":"git","url":"git+https://github.com/alrek-consulting/node-php-password.git"},"keywords":["php","password","security","bcrypt","hash"],"scripts":{"test":"mocha --reporter spec test"},"author":{"name":"Thomas Alrek","email":"thomas@alrek.no"},"license":"GPL-2.0","bugs":{"url":"https://github.com/alrek-consulting/node-php-password/issues"},"homepage":"https://github.com/alrek-consulting/node-php-password#readme","dependencies":{"bcryptjs":"^2.3.0","glob":"^7.0.5"},"devDependencies":{"mocha":"^2.4.5","chai":"^3.5.0"},"aliases":{"PASSWORD_DEFAULT":"PASSWORD_BCRYPT"},"gitHead":"a111c353d2211408b5062ac79922ed39a5c2112e","_id":"node-php-password@0.1.1","_shasum":"7a48a71500046916280d5da4996f9c9d9125eac7","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"alrek-consulting","email":"thomas@alrek.no"},"dist":{"shasum":"7a48a71500046916280d5da4996f9c9d9125eac7","tarball":"https://registry.npmjs.org/node-php-password/-/node-php-password-0.1.1.tgz","integrity":"sha512-cw4nF1r4/J5pwUsHFHORyvBkmqfM+df8X5sGx5q82gvkG6qu+ioRpjFIMW+hkFo1CWj51G0EEXm5xTOxZS0RPw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFfEw8mQOmCnufBwXpQKo/H2kCCoJwz7J/BTzzHrRt5vAiBcqdH79PR+Mx8jgPkT/AlOlW2tHLMSg0h60z4RVgqkPg=="}]},"maintainers":[{"name":"alrek-consulting","email":"thomas@alrek.no"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/node-php-password-0.1.1.tgz_1467664788723_0.27142639621160924"}},"0.1.2":{"name":"node-php-password","version":"0.1.2","description":"A node compatibility layer to verify and hash php compatible password hashes","main":"index.js","repository":{"type":"git","url":"git+https://github.com/alrek-consulting/node-php-password.git"},"keywords":["php","password","security","bcrypt","hash"],"scripts":{"test":"mocha --reporter spec test"},"author":{"name":"Thomas Alrek","email":"thomas@alrek.no"},"license":"GPL-2.0","bugs":{"url":"https://github.com/alrek-consulting/node-php-password/issues"},"homepage":"https://github.com/alrek-consulting/node-php-password#readme","dependencies":{"bcryptjs":"^2.3.0","glob":"^7.0.5"},"devDependencies":{"mocha":"^2.4.5","chai":"^3.5.0"},"aliases":{"PASSWORD_DEFAULT":"PASSWORD_BCRYPT"},"gitHead":"6ed06639a4aa4a0669b39e475f34ac8f4a092127","_id":"node-php-password@0.1.2","_shasum":"82a3adea8010fb214078f44df4e93edc535aba88","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.1.0","_npmUser":{"name":"thomas-alrek","email":"thomas@alrek.no"},"dist":{"shasum":"82a3adea8010fb214078f44df4e93edc535aba88","tarball":"https://registry.npmjs.org/node-php-password/-/node-php-password-0.1.2.tgz","integrity":"sha512-tGJ6GvAn4UOqZKzz7Y9RejTh0t5+vR/8OB5Hj3eaAVpfZDbrUp8JzdRUQnGv19Xx9i5Hr/ZK1gZc1CBv5wYoPQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCu4uSly+0qPLyrY2J6Po0mvI37lAIvtk/MRqbiTY8Q/wIgPwfsrVQZg8jZ3zAup7L2JU+eArlcJTl71Jcgt7vZwn8="}]},"maintainers":[{"name":"alrek-consulting","email":"thomas@alrek.no"},{"name":"thomas-alrek","email":"thomas@alrek.no"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/node-php-password-0.1.2.tgz_1493018675709_0.3813524714205414"}}},"readme":"# node-php-password\n\n*Verify password hashed generated in PHP, and hash passwords in the same format.*\n\nDesigned to be **future proof** for new hashing algorithms.\n\nnode-php-password is a solution for every kind of webapp which has a user database with passwords hashed with PHP's password_hash. Instead of starting from scratch, just use this package to get compatibility with PHP.\n\n### Installation\n```\nnpm install node-php-password\n```\n\n### Usage:\n```javascript\nvar Password = require(\"node-php-password\");\nvar hash = Password.hash(\"password123\");\n// Password.hash(password, [algorithm], [options]);\n```\n**Output:**\n```javascript\n\"$2y$10$8mNOnsos8qo4qHLcd32zrOg7gmyvfZ6/o9.2nsP/u6TRbrANdLREy\"\n```\n*If algorithm isn't defined, **\"PASSWORD_DEFAULT\"** will be used*\n\n*If no options is supplied, a **cryptographically secure** salt will be generated with the minimum recommended cost value.*\n\n### To verify a password against an existing hash in a database o.l:\n```javascript\nvar Password = require(\"node-php-password\");\nvar hash = \"$2y$10$8mNOnsos8qo4qHLcd32zrOg7gmyvfZ6/o9.2nsP/u6TRbrANdLREy\";\n\nif(Password.verify(\"password123\", hash)){\n   //Authentication OK\n}else{\n   //Authentication FAILED\n}\n```\n\n### Options\n```javascript\nvar Password = require(\"node-php-password\");\nvar options = {\n   cost: 10,\n   salt: \"qwertyuiopasdfghjklzxc\"\n}\n// Valid algorithms are \"PASSWORD_DEFAULT\", and \"PASSWORD_BCRYPT\"\n// \"PASSWORD_DEFAULT\" is just an alias to \"PASSWORD_BCRYPT\", to be more\n// compatible with PHP\nvar hash = Password.hash(\"password123\", \"PASSWORD_DEFAULT\", options);\n```\n\n**Output:**\n```javascript\n\"$2y$10$qwertyuiopasdfghjklzxO3U1f6PD/l04UrnxUgya51pjyLtkGNQi\"\n```\n\n**WARNING** It is not recommended to generate a salt manually. The default salt that is generated is a tested, and proven cryptographically secure value. Use this option with care.\nThe cost value should be set to a value that makes the hashing take at least 50ms.\n\n### Check if password needs rehash\nIf you have a mix of passwords hashed with different algorithms (md5, sha256, etc...), or with a different cost value, you can check if they comply with your password policy by checking if they need a rehash. If they do, you can prompt your user to update their password.\n```javascript\nvar Password = require(\"node-php-password\");\nvar user_password = \"password123\";\nvar hash = Password.hash(user_password, \"PASSWORD_DEFAULT\", {cost: 10});\n\nif(Password.verify(user_password, hash){\n   if(Password.needsRehash(hash, \"PASSWORD_DEFAULT\", {cost: 11}){\n      //Password needs to be rehashed\n      hash = Password.hash(user_password, \"PASSWORD_DEFAULT\", {cost: 11});\n   }\n}\n```\n","maintainers":[{"name":"thomas-alrek","email":"thomas@alrek.no"}],"time":{"modified":"2022-06-21T18:02:16.186Z","created":"2016-07-03T21:12:12.445Z","0.0.1":"2016-07-03T21:12:12.445Z","0.1.0":"2016-07-04T12:39:02.076Z","0.1.1":"2016-07-04T20:39:50.985Z","0.1.2":"2017-04-24T07:24:36.404Z"},"author":{"name":"Thomas Alrek","email":"thomas@alrek.no"},"license":"GPL-2.0","readmeFilename":"README.md","homepage":"https://github.com/alrek-consulting/node-php-password#readme","keywords":["php","password","security","bcrypt","hash"],"repository":{"type":"git","url":"git+https://github.com/alrek-consulting/node-php-password.git"},"bugs":{"url":"https://github.com/alrek-consulting/node-php-password/issues"}}