You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.7 KiB

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