README.md
1Port of the OpenBSD `bcrypt_pbkdf` function to pure Javascript. `npm`-ified
2version of [Devi Mandiri's port](https://github.com/devi/tmp/blob/master/js/bcrypt_pbkdf.js),
3with some minor performance improvements. The code is copied verbatim (and
4un-styled) from Devi's work.
5
6This product includes software developed by Niels Provos.
7
8## API
9
10### `bcrypt_pbkdf.pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds)`
11
12Derive a cryptographic key of arbitrary length from a given password and salt,
13using the OpenBSD `bcrypt_pbkdf` function. This is a combination of Blowfish and
14SHA-512.
15
16See [this article](http://www.tedunangst.com/flak/post/bcrypt-pbkdf) for
17further information.
18
19Parameters:
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
31Calculate a Blowfish hash, given SHA2-512 output of a password and salt. Used as
32part of the inner round function in the PBKDF.
33
34Parameters:
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
42This source form is a 1:1 port from the OpenBSD `blowfish.c` and `bcrypt_pbkdf.c`.
43As a result, it retains the original copyright and license. The two files are
44under slightly different (but compatible) licenses, and are here combined in
45one file. For each of the full license texts see `LICENSE`.
46