Skip to content

Commit a13ed61

Browse files
committed
[readme] clean up formatting
1 parent 4274b7c commit a13ed61

File tree

2 files changed

+54
-54
lines changed

2 files changed

+54
-54
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
# hash-base
22

3-
[![NPM Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base)
3+
[![npm Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base)
44
[![Build Status](https://img.shields.io/travis/crypto-browserify/hash-base.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/hash-base)
55
[![Dependency status](https://img.shields.io/david/crypto-browserify/hash-base.svg?style=flat-square)](https://david-dm.org/crypto-browserify/hash-base#info=dependencies)
66

7-
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
8-
97
Abstract base class to inherit from if you want to create streams implementing the same API as node crypto [Hash][1] (for [Cipher][2] / [Decipher][3] check [crypto-browserify/cipher-base][4]).
108

119
## Example
1210

1311
```js
14-
const HashBase = require('hash-base')
15-
const inherits = require('inherits')
12+
const HashBase = require('hash-base');
13+
const inherits = require('inherits');
1614

1715
// our hash function is XOR sum of all bytes
1816
function MyHash () {
19-
HashBase.call(this, 1) // in bytes
17+
HashBase.call(this, 1); // in bytes
2018

21-
this._sum = 0x00
22-
}
19+
this._sum = 0x00;
20+
};
2321

2422
inherits(MyHash, HashBase)
2523

2624
MyHash.prototype._update = function () {
27-
for (let i = 0; i < this._block.length; ++i) this._sum ^= this._block[i]
28-
}
25+
for (let i = 0; i < this._block.length; ++i) {
26+
this._sum ^= this._block[i];
27+
}
28+
};
2929

3030
MyHash.prototype._digest = function () {
31-
return this._sum
32-
}
31+
return this._sum;
32+
};
3333

34-
const data = Buffer.from([ 0x00, 0x42, 0x01 ])
35-
const hash = new MyHash().update(data).digest()
36-
console.log(hash) // => 67
34+
const data = Buffer.from([0x00, 0x42, 0x01]);
35+
const hash = new MyHash().update(data).digest();
36+
console.log(hash); // => 67
3737
```
3838
You also can check [source code](index.js) or [crypto-browserify/md5.js][5]
3939

package.json

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
{
2-
"name": "hash-base",
3-
"version": "3.0.4",
4-
"description": "abstract base class for hash-streams",
5-
"keywords": [
6-
"hash",
7-
"stream"
8-
],
9-
"homepage": "https://github.com/crypto-browserify/hash-base",
10-
"bugs": {
11-
"url": "https://github.com/crypto-browserify/hash-base/issues"
12-
},
13-
"license": "MIT",
14-
"author": "Kirill Fomichev <[email protected]> (https://github.com/fanatid)",
15-
"files": [
16-
"index.js"
17-
],
18-
"main": "index.js",
19-
"repository": {
20-
"type": "git",
21-
"url": "https://github.com/crypto-browserify/hash-base.git"
22-
},
23-
"scripts": {
24-
"coverage": "nyc node test/*.js",
25-
"lint": "standard",
26-
"test": "npm run lint && npm run unit",
27-
"unit": "node test/*.js"
28-
},
29-
"dependencies": {
30-
"inherits": "^2.0.1",
31-
"safe-buffer": "^5.0.1"
32-
},
33-
"devDependencies": {
34-
"nyc": "^8.3.2",
35-
"standard": "*",
36-
"tape": "^4.2.0"
37-
},
38-
"engines": {
39-
"node": ">=4"
40-
}
2+
"name": "hash-base",
3+
"version": "3.0.4",
4+
"description": "abstract base class for hash-streams",
5+
"keywords": [
6+
"hash",
7+
"stream"
8+
],
9+
"homepage": "https://github.com/crypto-browserify/hash-base",
10+
"bugs": {
11+
"url": "https://github.com/crypto-browserify/hash-base/issues"
12+
},
13+
"license": "MIT",
14+
"author": "Kirill Fomichev <[email protected]> (https://github.com/fanatid)",
15+
"files": [
16+
"index.js"
17+
],
18+
"main": "index.js",
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/crypto-browserify/hash-base.git"
22+
},
23+
"scripts": {
24+
"coverage": "nyc node test/*.js",
25+
"lint": "standard",
26+
"test": "npm run lint && npm run unit",
27+
"unit": "node test/*.js"
28+
},
29+
"dependencies": {
30+
"inherits": "^2.0.1",
31+
"safe-buffer": "^5.0.1"
32+
},
33+
"devDependencies": {
34+
"nyc": "^8.3.2",
35+
"standard": "*",
36+
"tape": "^4.2.0"
37+
},
38+
"engines": {
39+
"node": ">=4"
40+
}
4141
}

0 commit comments

Comments
 (0)