JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 691855
  • Score
    100M100P100Q185016F
  • License Public domain

SHA-256, HMAC and PBKDF2 implementation with typed arrays for modern browsers and Node.js

Package Exports

  • fast-sha256

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-sha256) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-sha256-js

SHA-256 implementation in JavaScript with typed arrays that works in modern browsers and Node.js. Implements the hash function, HMAC, and PBKDF2.

Public domain. No warranty.

Build Status

Installation

You can install fast-sha256-js via a package manager:

Bower:

$ bower install fast-sha256

NPM:

$ npm install fast-sha256

or download source code.

Usage

Functions accept and return Uint8Arrays. To convert strings, use external library (for example, nacl.util.

sha256(message)

Returns a SHA-256 hash of the message.

sha256.hmac(key, message)

Returns an HMAC-SHA-256 of the message for the key.

sha256.pbkdf2(password, salt, rounds, dkLen)

Returns a key of length dkLen derived using PBKDF2-HMAC-SHA256 from the given password, salt, and the number of rounds.

Testing and building

Install development dependencies:

$ npm install

Run tests:

$ npm test

Run tests on different source file:

$ SHA256_SRC=sha256.min.js npm test

Run benchmark:

$ npm run bench

(or in a browser, open tests/bench.html).

Build minified version:

$ npm run build