1 | Port of the OpenBSD `bcrypt_pbkdf` function to pure Javascript. `npm`-ified
|
---|
2 | version of [Devi Mandiri's port](https://github.com/devi/tmp/blob/master/js/bcrypt_pbkdf.js),
|
---|
3 | with some minor performance improvements. The code is copied verbatim (and
|
---|
4 | un-styled) from Devi's work.
|
---|
5 |
|
---|
6 | This product includes software developed by Niels Provos.
|
---|
7 |
|
---|
8 | ## API
|
---|
9 |
|
---|
10 | ### `bcrypt_pbkdf.pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds)`
|
---|
11 |
|
---|
12 | Derive a cryptographic key of arbitrary length from a given password and salt,
|
---|
13 | using the OpenBSD `bcrypt_pbkdf` function. This is a combination of Blowfish and
|
---|
14 | SHA-512.
|
---|
15 |
|
---|
16 | See [this article](http://www.tedunangst.com/flak/post/bcrypt-pbkdf) for
|
---|
17 | further information.
|
---|
18 |
|
---|
19 | Parameters:
|
---|
20 |
|
---|
21 | * `pass`, a Uint8Array of length `passlen`
|
---|
22 | * `passlen`, an integer Number
|
---|
23 | * `salt`, a Uint8Array of length `saltlen`
|
---|
24 | * `saltlen`, an integer Number
|
---|
25 | * `key`, a Uint8Array of length `keylen`, will be filled with output
|
---|
26 | * `keylen`, an integer Number
|
---|
27 | * `rounds`, an integer Number, number of rounds of the PBKDF to run
|
---|
28 |
|
---|
29 | ### `bcrypt_pbkdf.hash(sha2pass, sha2salt, out)`
|
---|
30 |
|
---|
31 | Calculate a Blowfish hash, given SHA2-512 output of a password and salt. Used as
|
---|
32 | part of the inner round function in the PBKDF.
|
---|
33 |
|
---|
34 | Parameters:
|
---|
35 |
|
---|
36 | * `sha2pass`, a Uint8Array of length 64
|
---|
37 | * `sha2salt`, a Uint8Array of length 64
|
---|
38 | * `out`, a Uint8Array of length 32, will be filled with output
|
---|
39 |
|
---|
40 | ## License
|
---|
41 |
|
---|
42 | This source form is a 1:1 port from the OpenBSD `blowfish.c` and `bcrypt_pbkdf.c`.
|
---|
43 | As a result, it retains the original copyright and license. The two files are
|
---|
44 | under slightly different (but compatible) licenses, and are here combined in
|
---|
45 | one file. For each of the full license texts see `LICENSE`.
|
---|