UNPKG

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