{"_id":"react-native-bcrypt","_rev":"4-839b8ffcb9887bb8a0999e6c0ade2555","name":"react-native-bcrypt","description":"Optimized bcrypt in plain JavaScript with zero dependencies. Compatible to 'bcrypt'.","dist-tags":{"latest":"2.4.0"},"versions":{"2.4.0":{"name":"react-native-bcrypt","description":"Optimized bcrypt in plain JavaScript with zero dependencies. Compatible to 'bcrypt'.","version":"2.4.0","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"},{"name":"Emir Aydin","email":"emir@emiraydin.com","url":"https://github.com/emiraydin"}],"repository":{"type":"url","url":"git+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":"index.js","browser":"dist/bcrypt.js","dependencies":{},"devDependencies":{"testjs":"~1","closurecompiler":"~1","metascript":"~0.18","bcrypt":"latest","utfx":"~1"},"license":"MIT","scripts":{"test":"node node_modules/testjs/bin/testjs","build":"node scripts/build.js","compile":"node node_modules/closurecompiler/bin/ccjs dist/bcrypt.js --compilation_level=ADVANCED_OPTIMIZATIONS --create_source_map=dist/bcrypt.min.map --externs=externs/minimal-env.js --output_wrapper=\"(function(){%output%})();\" > dist/bcrypt.min.js","compress":"gzip -c -9 dist/bcrypt.min.js > dist/bcrypt.min.js.gz","make":"npm run-script build && npm run-script compile && npm test"},"gitHead":"031e86f8b71f95fc2c9ab6dd5bb1ba11861dda01","homepage":"https://github.com/dcodeIO/bcrypt.js#readme","_id":"react-native-bcrypt@2.4.0","_shasum":"95dff2dbc849c22b25f0b9379ab7bfebd2140bfd","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"emiraydin","email":"emir@emiraydin.com"},"dist":{"shasum":"95dff2dbc849c22b25f0b9379ab7bfebd2140bfd","tarball":"https://registry.npmjs.org/react-native-bcrypt/-/react-native-bcrypt-2.4.0.tgz","integrity":"sha512-nC8SR/YCCLIluxd1YEkUX2/xjKELLkO0pgIZc1JGUw9o+wnsfpujm0J8NSPmPEqFUe1n2EkysHnAmuKInDusoQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDV4waNVNjfQ7RG26LAv11gP2xqlgxwNKkG5nGngs4f+gIhAJKga4JbBGnfmZzZ6zltGT/KneMczUIBYZI1TEgWSuVV"}]},"maintainers":[{"name":"emiraydin","email":"emir@emiraydin.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/react-native-bcrypt-2.4.0.tgz_1458593575057_0.8470706122461706"}}},"readme":"![bcrypt.js - Optimized bcrypt in JavaScript with zero dependencies](https://raw.github.com/dcodeIO/bcrypt.js/master/bcrypt.png)\n===========\nOptimized bcrypt in JavaScript with zero dependencies. Compatible to the C++ [bcrypt](https://npmjs.org/package/bcrypt)\nbinding on node.js and also working in the browser.\n\n[![Build Status](https://travis-ci.org/dcodeIO/bcrypt.js.svg?branch=master)](https://travis-ci.org/dcodeIO/bcrypt.js)\n[![Donate](https://raw.githubusercontent.com/dcodeIO/bcrypt.js/master/donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=info%40code-emitter.com&item_name=Open%20Source%3A%20bcrypt.js)\n\nSecurity considerations\n-----------------------\nBesides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the\niteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with\nincreasing computation power. ([see](http://en.wikipedia.org/wiki/Bcrypt))\n\nWhile bcrypt.js is compatible to the C++ bcrypt binding, it is written in pure JavaScript and thus slower ([about 2.7\ntimes](https://github.com/dcodeIO/bcrypt.js/wiki/Benchmark)), effectively reducing the number of iterations that can be\nprocessed in an equal time span.\n\nThe maximum input length is 72 bytes (note that UTF8 encoded characters use up to 4 bytes) and the length of generated\nhashes is 60 characters.\n\nUsage\n-----\nThe library is compatible with CommonJS and AMD loaders and is exposed globally as `dcodeIO.bcrypt` if neither is\navailable.\n\n### node.js\n\nOn node.js, the inbuilt [crypto module](http://nodejs.org/api/crypto.html)'s randomBytes interface is used to obtain\nsecure random numbers.\n\n`npm install bcryptjs`\n\n```js\nvar bcrypt = require('bcryptjs');\n...\n```\n\n### Browser\n\nIn the browser, bcrypt.js relies on [Web Crypto API](http://www.w3.org/TR/WebCryptoAPI)'s getRandomValues\ninterface to obtain secure random numbers. If no cryptographically secure source of randomness is available, you may\nspecify one through [bcrypt.setRandomFallback](https://github.com/dcodeIO/bcrypt.js#setrandomfallbackrandom).\n\n```js\nvar bcrypt = dcodeIO.bcrypt;\n...\n```\n\nor\n\n```js\nrequire.config({\n    paths: { \"bcrypt\": \"/path/to/bcrypt.js\" }\n});\nrequire([\"bcrypt\"], function(bcrypt) {\n    ...\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### setRandomFallback(random)\n\nSets the pseudo random number generator to use as a fallback if neither node's `crypto` module nor the Web Crypto\nAPI is available. Please note: It is highly important that the PRNG used is cryptographically secure and that it is\nseeded properly!\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| random          | *function(number):!Array.&lt;number&gt;* | Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values. \n| **@see**        |                 | http://nodejs.org/api/crypto.html \n| **@see**        |                 | http://www.w3.org/TR/WebCryptoAPI/\n\n**Hint:** You might use [isaac.js](https://github.com/rubycon/isaac.js) as a CSPRNG but you still have to make sure to\nseed it properly.\n\n### genSaltSync(rounds=, seed_length=)\n\nSynchronously generates a salt.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| rounds          | *number*        | Number of rounds to use, defaults to 10 if omitted \n| seed_length     | *number*        | Not supported. \n| **@returns**    | *string*        | Resulting salt \n| **@throws**     | *Error*         | If a random fallback is required but not set \n\n### genSalt(rounds=, seed_length=, callback)\n\nAsynchronously generates a salt.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| rounds          | *number &#124; function(Error, string=)* | Number of rounds to use, defaults to 10 if omitted \n| seed_length     | *number &#124; function(Error, string=)* | Not supported. \n| callback        | *function(Error, string=)* | Callback receiving the error, if any, and the resulting salt \n\n### hashSync(s, salt=)\n\nSynchronously generates a hash for the given string.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| s               | *string*        | String to hash \n| salt            | *number &#124; string* | Salt length to generate or salt to use, default to 10 \n| **@returns**    | *string*        | Resulting hash \n\n### hash(s, salt, callback, progressCallback=)\n\nAsynchronously generates a hash for the given string.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| s               | *string*        | String to hash \n| salt            | *number &#124; 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| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms. \n\n### compareSync(s, hash)\n\nSynchronously tests a string against a hash.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| s               | *string*        | String to compare \n| hash            | *string*        | Hash to test against \n| **@returns**    | *boolean*       | true if matching, otherwise false \n| **@throws**     | *Error*         | If an argument is illegal \n\n### compare(s, hash, callback, progressCallback=)\n\nAsynchronously compares the given data against the given hash.\n\n| Parameter       | 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| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms. \n| **@throws**     | *Error*         | If the callback argument is invalid \n\n### getRounds(hash)\n\nGets the number of rounds used to encrypt the specified hash.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| hash            | *string*        | Hash to extract the used number of rounds from \n| **@returns**    | *number*        | Number of rounds used \n| **@throws**     | *Error*         | If hash is not a string \n\n### getSalt(hash)\n\nGets the salt portion from a hash. Does not validate the hash.\n\n| Parameter       | Type            | Description\n|-----------------|-----------------|---------------\n| hash            | *string*        | Hash to extract the salt from \n| **@returns**    | *string*        | Extracted salt part \n| **@throws**     | *Error*         | If `hash` is not a string or otherwise invalid \n\n\nCommand line\n------------\n`Usage: bcrypt <input> [salt]`\n\nIf the input has spaces inside, simply surround it with quotes.\n\nDownloads\n---------\n* [Distributions](https://github.com/dcodeIO/bcrypt.js/tree/master/dist)\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-------\nNew-BSD / MIT ([see](https://github.com/dcodeIO/bcrypt.js/blob/master/LICENSE))\n","maintainers":[{"name":"emiraydin","email":"emir@emiraydin.com"}],"time":{"modified":"2022-06-26T03:42:23.663Z","created":"2016-03-21T20:52:55.537Z","2.4.0":"2016-03-21T20:52:55.537Z"},"homepage":"https://github.com/dcodeIO/bcrypt.js#readme","keywords":["bcrypt","password","auth","authentication","encryption","crypt","crypto"],"repository":{"type":"url","url":"git+https://github.com/dcodeIO/bcrypt.js.git"},"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"},{"name":"Emir Aydin","email":"emir@emiraydin.com","url":"https://github.com/emiraydin"}],"author":{"name":"Daniel Wirtz","email":"dcode@dcode.io"},"bugs":{"url":"https://github.com/dcodeIO/bcrypt.js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"tomgao365":true}}