isomorphic-crypto

3.0.0 • Public • Published

isomorphic-crypto NPM Version

Isomorphic crypto package for node and the browser. Uses the native crypto module when run in node and crypto-browserify when run in the browser. Use it for hashing, signing and your other crypto needs!

Installation

npm install --save isomorphic-crypto
 
# using yarn: 
 
yarn add isomorphic-crypto

Usage

Have a look at the official crypto documentation.

Please be aware that the browser version of this library uses crypto-browserify, which is only a partial implementation of node's native crypto module. Check out their documentation to see what is supported and what not.

Example

const crypto = require('isomorphic-crypto')
 
function sha512 (string) {
  const hash = crypto.createHash('sha512')
  hash.write(string)
  return hash.digest('hex')
}
 
console.log(`sha512('crypto rocks') = ${sha512('crypto rocks')}`)

Versioning

The library's major version matches the major version of the crypto-browserify package. The minor and patch version can be bumped independently.

License

MIT

Package Sidebar

Install

npm i isomorphic-crypto

Weekly Downloads

1,229

Version

3.0.0

License

MIT

Last publish

Collaborators

  • andywer