create-hash
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
cipher-base | 1.0.4 | 2.97 kB | MIT | prod | |
inherits | 2.0.4 | 1.98 kB | ISC | prod | |
md5.js | 1.3.5 | 3.07 kB | MIT | prod | |
ripemd160 | 2.0.2 | 3.69 kB | MIT | prod | |
sha.js | 2.4.11 | 9.74 kB | (MIT AND BSD-3-Clause) | prod |
The "create-hash" is a popular npm package that's primarily designed to create hashes for browserify. It brings the use of Node style hashes to the browser environment, maintaining compatibility with native hash functions in node.
To use the "create-hash" package, you first need to install it using npm by running npm install create-hash
in your terminal. Once installed, it can be used as follows:
var createHash = require('create-hash')
var hash = createHash('sha224')
hash.update('synchronous write') // optional encoding parameter
hash.digest() // synchronously get result with optional encoding parameter
hash.write('write to it as a stream')
hash.end() // remember it's a stream
hash.read() // only if you ended it as a stream though
In the above example, 'sha224' is the hash algorithm used. The hash object is updated with the data we wish to hash using the hash.update()
function, and the result is obtained using hash.digest()
. If you want to force the JavaScript version even in node, use require('create-hash/browser')
.
The documentation for the "create-hash" package can be found on its GitHub repository. There's no dedicated website for the documentation, but the README file in the GitHub repository provides a basic introduction to the API and usage examples. Additional information can also be gleaned by reviewing the code and exploring the tests in the repository.