{"name":"bcryptjs","description":"Optimized bcrypt in plain JavaScript with zero dependencies. 100% typed code. Fully compatible to 'bcrypt'.","version":"0.7.7","author":{"name":"Daniel Wirtz","email":"dcode@dcode.io"},"contributors":[{"name":"Shane Girish","email":"shaneGirish@gmail.com","url":"https://github.com/shaneGirish"},{"name":"Alex Murray","url":"https://github.com/alexmurray"},{"name":"Nicolas Pelletier","url":"https://github.com/NicolasPelletier"},{"name":"Josh Rogers","url":"https://github.com/geekymole"},{"name":"Noah Isaacson","email":"noah@nisaacson.com","url":"https://github.com/nisaacson"}],"repository":{"type":"url","url":"https://github.com/dcodeIO/bcrypt.js.git"},"bugs":{"url":"https://github.com/dcodeIO/bcrypt.js/issues"},"keywords":["bcrypt","password","auth","authentication","encryption","crypt","crypto"],"main":"./bcrypt.min.js","dependencies":{},"devDependencies":{"testjs":"latest","preprocessor":"latest","closurecompiler":"latest"},"license":"Apache-2.0","scripts":{"test":"testjs","build":"preprocess ./src/bcrypt.js ./src > ./bcrypt.js","compile":"ccjs bcrypt.js --warning_level=VERBOSE --compilation_level=ADVANCED_OPTIMIZATIONS --externs=externs/minimal-env.js > bcrypt.min.js","make":"npm run-script build && npm run-script compile && npm test"},"readmeFilename":"README.md","_id":"bcryptjs@0.7.7","dist":{"tarball":"https://registry.npmmirror.com/bcryptjs/-/bcryptjs-0.7.7.tgz","shasum":"685515075d6459ae5d90b468df8afff78e5e1332","size":44575,"noattachment":false,"integrity":"sha512-/SR/8uLOwqFV56RRtn1HBv2zZSUEWZkkXqJ+k/BXNC1urbGIm77gO3MPEejGmszKa9Ov0RyIt3WDtKlDvFHt0w=="},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"directories":{},"publish_time":1367616940629,"_hasShrinkwrap":false,"_cnpm_publish_time":1367616940629,"_cnpmcore_publish_time":"2021-12-16T11:52:33.564Z","readme":"![bcrypt.js - bcrypt in plain JavaScript](https://raw.github.com/dcodeIO/bcrypt.js/master/bcrypt.png)\n===========\nOptimized bcrypt in plain JavaScript with zero dependencies. Compiled through Closure Compiler using advanced\noptimizations, 100% typed code. Fully compatible to [bcrypt](https://npmjs.org/package/bcrypt) and also working in the\nbrowser.\n\nFeatures\n--------\n* CommonJS/node.js compatible (via [crypto](http://nodejs.org/api/crypto.html)), also available via [npm](https://npmjs.org/package/bcryptjs) \n* Shim/browser compatible (via [WebCryptoAPI](http://www.w3.org/TR/WebCryptoAPI))\n* RequireJS/AMD compatible\n* Zero production dependencies\n* Small footprint\n* Closure Compiler [externs included](https://github.com/dcodeIO/bcrypt.js/blob/master/externs/bcrypt.js)\n\nUsage\n-----\n\n#### node.js\n`npm install bcryptjs`\n\n```javascript\nvar bcrypt = require('bcryptjs');\n...\n```\n\n#### RequireJS/AMD\n```javascript\nrequire.config({\n \"paths\": {\n \"bcrypt\": \"/path/to/bcrypt.js\"\n }\n});\nrequire([\"bcrypt\"], function(bcrypt) {\n ...\n});\n```\n\n#### Shim/browser\n```html\n\n```\n```javascript\nvar bcrypt = dcodeIO.bcrypt;\n...\n```\n\nUsage - Sync\n------------\nTo hash a password: \n\n```javascript\nvar bcrypt = require('bcryptjs');\nvar salt = bcrypt.genSaltSync(10);\nvar hash = bcrypt.hashSync(\"B4c0/\\/\", salt);\n// Store hash in your password DB.\n```\n\nTo check a password: \n\n```javascript\n// Load hash from your password DB.\nbcrypt.compareSync(\"B4c0/\\/\", hash); // true\nbcrypt.compareSync(\"not_bacon\", hash); // false\n```\n\nAuto-gen a salt and hash:\n\n```javascript\nvar hash = bcrypt.hashSync('bacon', 8);\n```\n\nUsage - Async\n-------------\nTo hash a password: \n\n```javascript\nvar bcrypt = require('bcryptjs');\nbcrypt.genSalt(10, function(err, salt) {\n bcrypt.hash(\"B4c0/\\/\", salt, function(err, hash) {\n // Store hash in your password DB.\n });\n});\n```\n\nTo check a password: \n\n```javascript\n// Load hash from your password DB.\nbcrypt.compare(\"B4c0/\\/\", hash, function(err, res) {\n // res == true\n});\nbcrypt.compare(\"not_bacon\", hash, function(err, res) {\n // res = false\n});\n```\n\nAuto-gen a salt and hash:\n\n```javascript\nbcrypt.hash('bacon', 8, function(err, hash) {\n});\n```\n\nAPI\n---\n\n - [bcrypt](#bcrypt)\n - [bcrypt.genSaltSync(rounds\\*, seed_length\\*)](#bcryptgensaltsyncrounds-seed_length)\n - [bcrypt.genSalt(rounds\\*, seed_length\\*, callback\\*)](#bcryptgensaltrounds-seed_length-callback)\n - [bcrypt.hashSync(s, salt\\*)](#bcrypthashsyncs-salt)\n - [bcrypt.hash(s, salt, callback)](#bcrypthashs-salt-callback)\n - [bcrypt.compareSync(s, hash)](#bcryptcomparesyncs-hash)\n - [bcrypt.compare(s, hash, callback)](#bcryptcompares-hash-callback)\n - [bcrypt.getRounds(hash)](#bcryptgetroundshash)\n - [bcrypt.getSalt(hash)](#bcryptgetsalthash)\n\n### bcrypt\nbcrypt namespace.\n\n\n### bcrypt.genSaltSync(rounds\\*, seed_length\\*)\nSynchronously generates a salt.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| rounds\\* | number | Number of rounds to use, defaults to 10 if omitted |\n| seed_length\\* | number | Not supported. |\n| |||\n| **returns** | string | Resulting salt\n\n### bcrypt.genSalt(rounds\\*, seed_length\\*, callback\\*)\nAsynchronously generates a salt.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| rounds\\* | (number ¦ function(Error, ?string)) | Number of rounds to use, defaults to 10 if omitted |\n| seed_length\\* | (number ¦ function(Error, ?string)) | Not supported. |\n| callback\\* | function(Error, ?string) | Callback receiving the error, if any, and the resulting salt |\n\n### bcrypt.hashSync(s, salt\\*)\nSynchronously generates a hash for the given string.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| s | string | String to hash |\n| salt\\* | (number ¦ string) | Salt length to generate or salt to use, default to 10 |\n| |||\n| **returns** | ?string | Resulting hash, actually never null\n\n### bcrypt.hash(s, salt, callback)\nAsynchronously generates a hash for the given string.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| s | string | String to hash |\n| salt | number ¦ string | Salt length to generate or salt to use |\n| callback | function(Error, ?string) | Callback receiving the error, if any, and the resulting hash |\n\n### bcrypt.compareSync(s, hash)\nSynchronously tests a string against a hash.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| s | string | String to compare |\n| hash | string | Hash to test against |\n| |||\n| **returns** | boolean | true if matching, otherwise false\n| **throws** | Error | If an argument is illegal\n\n### bcrypt.compare(s, hash, callback)\nAsynchronously compares the given data against the given hash.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| s | string | Data to compare |\n| hash | string | Data to be compared to |\n| callback | function(Error, boolean) | Callback receiving the error, if any, otherwise the result |\n| |||\n| **throws** | Error | If the callback argument is invalid\n\n### bcrypt.getRounds(hash)\nGets the number of rounds used to encrypt the specified hash.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| hash | string | Hash to extract the used number of rounds from |\n| |||\n| **returns** | number | Number of rounds used\n| **throws** | Error | If hash is not a string\n\n### bcrypt.getSalt(hash)\nGets the salt portion from a hash.\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| hash | string | Hash to extract the salt from |\n| |||\n| **returns** | string | Extracted salt part portion\n| **throws** | Error | If `hash` is not a string or otherwise invalid\n\nCommand line\n------------\n`Usage: bcrypt [salt]`\n\nIf the input got spaces inside, simply surround it with quotes.\n\nDownloads\n---------\n* [ZIP-Archive](https://github.com/dcodeIO/bcrypt.js/archive/master.zip)\n* [Tarball](https://github.com/dcodeIO/bcrypt.js/tarball/master)\n\nCredits\n-------\nBased on work started by Shane Girish at [bcrypt-nodejs](https://github.com/shaneGirish/bcrypt-nodejs) (MIT-licensed),\nwhich is itself based on [javascript-bcrypt](http://code.google.com/p/javascript-bcrypt/) (New BSD-licensed).\n\nLicense\n-------\nApache License, Version 2.0 if not stated otherwise\n"}