sha.js
Streamable SHA hashes in pure javascript
Last updated 9 months ago by ljharb .
(MIT AND BSD-3-Clause) · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sha.js 
SYNC missed versions from official npm registry.

sha.js

NPM Package Build Status Dependency status

js-standard-style

Node style SHA on pure JavaScript.

var shajs = require('sha.js')

console.log(shajs('sha256').update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
console.log(new shajs.sha256().update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049

var sha256stream = shajs('sha256')
sha256stream.end('42')
console.log(sha256stream.read().toString('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049

supported hashes

sha.js currently implements:

  • SHA (SHA-0) -- legacy, do not use in new systems
  • SHA-1 -- legacy, do not use in new systems
  • SHA-224
  • SHA-256
  • SHA-384
  • SHA-512

Not an actual stream

Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial. It does update incrementally, so you can hash things larger than RAM, as it uses a constant amount of memory (except when using base64 or utf8 encoding, see code comments).

Acknowledgements

This work is derived from Paul Johnston's A JavaScript implementation of the Secure Hash Algorithm.

LICENSE MIT AND BSD-3-Clause

Current Tags

  • 2.4.12                                ...           latest (9 months ago)

40 Versions

  • 2.4.12                                ...           9 months ago
  • 2.4.11                                ...           8 years ago
  • 2.4.10                                ...           8 years ago
  • 2.4.9                                ...           9 years ago
  • 2.4.8                                ...           9 years ago
  • 2.4.7                                ...           9 years ago
  • 2.4.5                                ...           10 years ago
  • 2.4.4                                ...           11 years ago
  • 2.4.3                                ...           11 years ago
  • 2.4.2                                ...           11 years ago
  • 2.4.1                                ...           11 years ago
  • 2.4.0                                ...           11 years ago
  • 2.3.6                                ...           11 years ago
  • 2.3.5                                ...           11 years ago
  • 2.3.4                                ...           11 years ago
  • 2.3.3                                ...           11 years ago
  • 2.3.2                                ...           11 years ago
  • 2.3.1                                ...           11 years ago
  • 2.3.0                                ...           11 years ago
  • 2.2.7                                ...           11 years ago
  • 2.2.6                                ...           12 years ago
  • 2.2.5                                ...           12 years ago
  • 2.2.4                                ...           12 years ago
  • 2.2.3                                ...           12 years ago
  • 2.2.2                                ...           12 years ago
  • 2.1.8                                ...           12 years ago
  • 2.1.7                                ...           12 years ago
  • 2.1.6                                ...           12 years ago
  • 2.1.5                                ...           12 years ago
  • 2.1.4                                ...           12 years ago
  • 2.1.3                                ...           12 years ago
  • 2.1.1                                ...           12 years ago
  • 2.0.0                                ...           12 years ago
  • 1.3.0                                ...           12 years ago
  • 1.2.2                                ...           12 years ago
  • 1.2.1                                ...           12 years ago
  • 1.2.0                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Downloads
Today 0
This Week 71
This Month 99
Last Day 11
Last Week 42
Last Month 193
Dependencies (3)
Dev Dependencies (8)

Copyright 2013 - present © cnpmjs.org | Home |