isomorphic-crypto
v3.0.0
Published
Isomorphic crypto package for node and the browser.
Downloads
7,102
Maintainers
Readme
isomorphic-crypto
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