Comparing version 0.7.6 to 0.7.7
@@ -14,3 +14,3 @@ { | ||
"main": "./bcrypt", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"author": "Nick Campbell (http://github.com/ncb000gt)", | ||
@@ -17,0 +17,0 @@ "engines": { |
120
README.md
@@ -1,3 +0,2 @@ | ||
node.bcrypt.js | ||
============= | ||
# node.bcrypt.js | ||
@@ -11,4 +10,3 @@ [![Build Status](https://secure.travis-ci.org/ncb000gt/node.bcrypt.js.png)](http://travis-ci.org/#!/ncb000gt/node.bcrypt.js) | ||
If You Are Submitting Bugs/Issues | ||
============= | ||
## If You Are Submitting Bugs/Issues | ||
@@ -18,4 +16,3 @@ Because we can't magically know what you are doing to expose an issue, it is best if you provide a snippet of code. This snippet need not include your secret sauce, but it must replicate the issue you are describing. The issues that get closed without resolution tend to be the ones without code examples. Thanks. | ||
Version Compatability | ||
============= | ||
## Version Compatability | ||
@@ -41,4 +38,3 @@ <table> | ||
Security Issues/Concerns | ||
============= | ||
## Security Issues/Concerns | ||
@@ -51,4 +47,3 @@ As should be the case with any security tool, this library should be scrutinized by anyone using it. If you find or suspect an issue with the code- please bring it to my attention and I'll spend some time trying to make sure that this tool is as secure as possible. | ||
Dependencies | ||
============= | ||
## Dependencies | ||
@@ -58,2 +53,3 @@ * NodeJS | ||
* For Windows you'll need http://slproweb.com/products/Win32OpenSSL.html installed to the default location of `C:\OpenSSL-Win32` | ||
* When installing OpenSSL, you must tell it to put DLLs in `The Windows system directory` to avoid `The specified module could not be found.` errors. | ||
* Please note that for this to build properly you'll need the Normal version of OpenSSL-Win<arch>, not the Light version. The reason for this is that we need to be able to compile the code using the header files that exist in the Normal version. | ||
@@ -66,39 +62,32 @@ * For 64 bit use the 64 bit version and install to `C:\OpenSSL-Win64` | ||
From NPM | ||
============ | ||
## Install via NPM | ||
``` | ||
npm install bcrypt | ||
``` | ||
npm install bcrypt | ||
## Usage | ||
### async (recommended) | ||
From Source | ||
============ | ||
To hash a password: | ||
Assuming you've already built node, you can compile the module with `node-gyp`: | ||
git clone git://github.com/ncb000gt/node.bcrypt.js.git | ||
cd node.bcrypt.js | ||
node-gyp configure | ||
node-gyp build | ||
Note: if you do not have node-gyp installed, install it using: `npm install -g node-gyp` | ||
Usage - Sync | ||
============ | ||
To hash a password: | ||
```javascript | ||
var bcrypt = require('bcrypt'); | ||
var salt = bcrypt.genSaltSync(10); | ||
var hash = bcrypt.hashSync("B4c0/\/", salt); | ||
// Store hash in your password DB. | ||
bcrypt.genSalt(10, function(err, salt) { | ||
bcrypt.hash("B4c0/\/", salt, function(err, hash) { | ||
// Store hash in your password DB. | ||
}); | ||
}); | ||
``` | ||
To check a password: | ||
To check a password: | ||
```javascript | ||
// Load hash from your password DB. | ||
bcrypt.compareSync("B4c0/\/", hash); // true | ||
bcrypt.compareSync("not_bacon", hash); // false | ||
bcrypt.compare("B4c0/\/", hash, function(err, res) { | ||
// res == true | ||
}); | ||
bcrypt.compare("not_bacon", hash, function(err, res) { | ||
// res = false | ||
}); | ||
``` | ||
@@ -109,29 +98,24 @@ | ||
```javascript | ||
var hash = bcrypt.hashSync('bacon', 8); | ||
bcrypt.hash('bacon', 8, function(err, hash) { | ||
}); | ||
``` | ||
Usage - Async | ||
============ | ||
To hash a password: | ||
### sync | ||
To hash a password: | ||
```javascript | ||
var bcrypt = require('bcrypt'); | ||
bcrypt.genSalt(10, function(err, salt) { | ||
bcrypt.hash("B4c0/\/", salt, function(err, hash) { | ||
// Store hash in your password DB. | ||
}); | ||
}); | ||
var salt = bcrypt.genSaltSync(10); | ||
var hash = bcrypt.hashSync("B4c0/\/", salt); | ||
// Store hash in your password DB. | ||
``` | ||
To check a password: | ||
To check a password: | ||
```javascript | ||
// Load hash from your password DB. | ||
bcrypt.compare("B4c0/\/", hash, function(err, res) { | ||
// res == true | ||
}); | ||
bcrypt.compare("not_bacon", hash, function(err, res) { | ||
// res = false | ||
}); | ||
bcrypt.compareSync("B4c0/\/", hash); // true | ||
bcrypt.compareSync("not_bacon", hash); // false | ||
``` | ||
@@ -142,8 +126,6 @@ | ||
```javascript | ||
bcrypt.hash('bacon', 8, function(err, hash) { | ||
}); | ||
var hash = bcrypt.hashSync('bacon', 8); | ||
``` | ||
API | ||
============ | ||
## API | ||
@@ -183,17 +165,16 @@ `BCrypt.` | ||
Hash Info | ||
============ | ||
## Hash Info | ||
The characters that comprise the resultant hash are `./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$`. | ||
Testing | ||
============ | ||
## Testing | ||
If you create a pull request, tests better pass :) | ||
npm install | ||
npm test | ||
``` | ||
npm install | ||
npm test | ||
``` | ||
Credits | ||
============ | ||
## Credits | ||
@@ -207,4 +188,3 @@ The code for this comes from a few sources: | ||
Contributors | ||
============ | ||
## Contributors | ||
@@ -226,10 +206,6 @@ * [Antonio Salazar Cardozo][shadowfiend] - Early MacOS X support (when we used libbsd) | ||
License | ||
============ | ||
## License | ||
Unless stated elsewhere, file headers or otherwise, the license as stated in the LICENSE file. | ||
[bcryptwiki]: http://en.wikipedia.org/wiki/Bcrypt | ||
[bcryptwiki]: http://en.wikipedia.org/wiki/Bcrypt | ||
[bcryptgs]: http://mail-index.netbsd.org/tech-crypto/2002/05/24/msg000204.html | ||
@@ -236,0 +212,0 @@ [codahale]: http://codahale.com/how-to-safely-store-a-password/ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87988
220