|
4 年之前 | |
---|---|---|
.. | ||
test | 7 年之前 | |
.npmignore | 7 年之前 | |
.travis.yml | 7 年之前 | |
LICENSE | 7 年之前 | |
README.md | 7 年之前 | |
bin.js | 7 年之前 | |
hash.js | 7 年之前 | |
hexpp.js | 7 年之前 | |
index.js | 7 年之前 | |
package.json | 4 年之前 | |
sha.js | 7 年之前 | |
sha1.js | 7 年之前 | |
sha224.js | 7 年之前 | |
sha256.js | 7 年之前 | |
sha384.js | 7 年之前 | |
sha512.js | 7 年之前 |
Streamable SHA hashes in pure javascript.
var createHash = require('sha.js')
var sha256 = createHash('sha256')
var sha512 = createHash('sha512')
var h = sha256.update('abc', 'utf8').digest('hex')
console.log(h) //ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
//LEGACY, do not use in new systems:
var sha0 = createHash('sha')
var sha1 = createHash('sha1')
sha.js currently implements:
Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial. but is does update incrementally, so you can hash things larger than ram, and also, since it reuses the typedarrays, it uses a constant amount of memory (except when using base64 or utf8 encoding, see code comments)
This work is derived from Paul Johnston's "A JavaScript implementation of the Secure Hash Algorithm"
MIT