Skip to content

Commit 2d65484

Browse files
committed
README: remove typed array comments, re-format support algorithms
1 parent c233442 commit 2d65484

File tree

2 files changed

+27
-36
lines changed

2 files changed

+27
-36
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
npm-debug.log

README.md

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,44 @@
11
# sha.js
2+
[![NPM Package](https://img.shields.io/npm/v/sha.js.svg?style=flat-square)](https://www.npmjs.org/package/sha.js)
3+
[![Build Status](https://img.shields.io/travis/crypto-browserify/sha.js.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/sha.js)
4+
[![Dependency status](https://img.shields.io/david/crypto-browserify/sha.js.svg?style=flat-square)](https://david-dm.org/crypto-browserify/sha.js#info=dependencies)
25

3-
Streamable SHA hashes in pure javascript.
6+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
47

5-
[![build status](https://secure.travis-ci.org/crypto-browserify/sha.js.png)](http://travis-ci.org/crypto-browserify/sha.js)
6-
[![NPM](http://img.shields.io/npm/v/sha.js.svg)](https://www.npmjs.org/package/sha.js)
8+
Node style `SHA` on pure JavaScript.
79

10+
```js
11+
var shajs = require('sha.js')
812

9-
## Example
10-
11-
``` js
12-
var createHash = require('sha.js')
13-
14-
var sha256 = createHash('sha256')
15-
var sha512 = createHash('sha512')
16-
17-
var h = sha256.update('abc', 'utf8').digest('hex')
18-
console.log(h) //ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
19-
20-
//LEGACY, do not use in new systems:
21-
var sha0 = createHash('sha')
22-
var sha1 = createHash('sha1')
23-
13+
console.log(shajs('sha256').update('42').digest('hex'))
14+
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
15+
console.log(new shajs.SHA256().update('42').digest('hex'))
16+
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
2417

18+
var sha256stream = shajs('sha256')
19+
sha256stream.end('42')
20+
console.log(sha256stream.read().toString('hex'))
21+
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
2522
```
2623

2724
## supported hashes
25+
`sha.js` currently implements:
2826

29-
sha.js currently implements:
27+
- SHA (SHA-0) -- **legacy, do not use in new systems**
28+
- SHA-1 -- **legacy, do not use in new systems**
29+
- SHA-224
30+
- SHA-256
31+
- SHA-384
32+
- SHA-512
3033

3134

32-
* sha256
33-
* sha512
34-
* sha1 (legacy, no not use in new systems)
35-
* sha (legacy, no not use in new systems)
36-
37-
## Note
38-
35+
## Not an actual stream
3936
Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial.
40-
but is does update incrementally, so you can hash things larger than ram, and also, since it reuses
41-
the typedarrays, it uses a constant amount of memory (except when using base64 or utf8 encoding,
42-
see code comments)
37+
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).
4338

4439

4540
## Acknowledgements
41+
This work is derived from Paul Johnston's [A JavaScript implementation of the Secure Hash Algorithm](http://pajhome.org.uk/crypt/md5/sha1.html).
4642

47-
This work is derived from Paul Johnston's ["A JavaScript implementation of the Secure Hash Algorithm"]
48-
(http://pajhome.org.uk/crypt/md5/sha1.html)
49-
50-
51-
52-
## License
5343

54-
MIT
44+
## LICENSE [MIT](LICENSE)

0 commit comments

Comments
 (0)