1
|
# hmac-drbg
|
2
|
[![Build Status](https://secure.travis-ci.org/indutny/hmac-drbg.svg)](http://travis-ci.org/indutny/hmac-drbg)
|
3
|
[![NPM version](https://badge.fury.io/js/hmac-drbg.svg)](http://badge.fury.io/js/hmac-drbg)
|
4
|
|
5
|
JS-only implementation of [HMAC DRBG][0].
|
6
|
|
7
|
## Usage
|
8
|
|
9
|
```js
|
10
|
const DRBG = require('hmac-drbg');
|
11
|
const hash = require('hash.js');
|
12
|
|
13
|
const d = new DRBG({
|
14
|
hash: hash.sha256,
|
15
|
entropy: '0123456789abcdef',
|
16
|
nonce: '0123456789abcdef',
|
17
|
pers: '0123456789abcdef' /* or `null` */
|
18
|
});
|
19
|
|
20
|
d.generate(32, 'hex');
|
21
|
```
|
22
|
|
23
|
#### LICENSE
|
24
|
|
25
|
This software is licensed under the MIT License.
|
26
|
|
27
|
Copyright Fedor Indutny, 2017.
|
28
|
|
29
|
Permission is hereby granted, free of charge, to any person obtaining a
|
30
|
copy of this software and associated documentation files (the
|
31
|
"Software"), to deal in the Software without restriction, including
|
32
|
without limitation the rights to use, copy, modify, merge, publish,
|
33
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
34
|
persons to whom the Software is furnished to do so, subject to the
|
35
|
following conditions:
|
36
|
|
37
|
The above copyright notice and this permission notice shall be included
|
38
|
in all copies or substantial portions of the Software.
|
39
|
|
40
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
41
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
42
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
43
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
44
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
45
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
46
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
|
|
48
|
[0]: http://csrc.nist.gov/groups/ST/toolkit/documents/rng/HashBlockCipherDRBG.pdf
|