├── .npmrc ├── .nycrc ├── .github ├── workflows │ ├── node-pretest.yml │ ├── require-allow-edits.yml │ ├── node-aught.yml │ ├── node-tens.yml │ ├── node-twenties.yml │ └── rebase.yml └── FUNDING.yml ├── .gitignore ├── .eslintrc ├── to-buffer.js ├── LICENSE ├── README.md ├── package.json ├── index.js ├── test └── index.js └── CHANGELOG.md /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | allow-same-version=true 3 | message=v%s 4 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "check-coverage": false, 4 | "reporter": ["text-summary", "text", "html", "json"], 5 | "exclude": [ 6 | "coverage", 7 | "test" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.github/workflows/node-pretest.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: pretest/posttest' 2 | 3 | on: [pull_request, push] 4 | 5 | jobs: 6 | tests: 7 | uses: ljharb/actions/.github/workflows/pretest.yml@main 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .nyc_output 2 | coverage 3 | node_modules 4 | 5 | npm-debug.log 6 | 7 | # Only apps should have lockfiles 8 | npm-shrinkwrap.json 9 | package-lock.json 10 | yarn.lock 11 | 12 | .npmignore 13 | -------------------------------------------------------------------------------- /.github/workflows/require-allow-edits.yml: -------------------------------------------------------------------------------- 1 | name: Require “Allow Edits” 2 | 3 | on: [pull_request_target] 4 | 5 | jobs: 6 | _: 7 | name: "Require “Allow Edits”" 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: ljharb/require-allow-edits@main 13 | -------------------------------------------------------------------------------- /.github/workflows/node-aught.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js < 10' 2 | 3 | on: [pull_request, push] 4 | 5 | jobs: 6 | tests: 7 | uses: ljharb/actions/.github/workflows/node.yml@main 8 | with: 9 | range: '0.8 - 9' 10 | type: minors 11 | command: npm run tests-only 12 | -------------------------------------------------------------------------------- /.github/workflows/node-tens.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js >= 10' 2 | 3 | on: [pull_request, push] 4 | 5 | jobs: 6 | tests: 7 | uses: ljharb/actions/.github/workflows/node.yml@main 8 | with: 9 | range: '>= 10' 10 | type: minors 11 | command: npm run tests-only 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | 4 | "extends": "@ljharb", 5 | 6 | "globals": { 7 | "Uint8Array": "readonly", 8 | "Uint16Array": "readonly", 9 | }, 10 | 11 | "rules": { 12 | "array-bracket-newline": "off", 13 | "func-style": ["error", "declaration"], 14 | "no-underscore-dangle": "off", 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/node-twenties.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js >= 20' 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | tests: 10 | uses: ljharb/actions/.github/workflows/node.yml@main 11 | with: 12 | range: '>= 20' 13 | type: minors 14 | command: npm run tests-only 15 | -------------------------------------------------------------------------------- /.github/workflows/rebase.yml: -------------------------------------------------------------------------------- 1 | name: Automatic Rebase 2 | 3 | on: [pull_request_target] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | _: 10 | permissions: 11 | contents: write # for ljharb/rebase to push code to rebase 12 | pull-requests: read # for ljharb/rebase to get info about PR 13 | 14 | name: "Automatic Rebase" 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: ljharb/rebase@master 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [ljharb] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: npm/hash-base 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /to-buffer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Buffer = require('safe-buffer').Buffer; 4 | var toBuffer = require('to-buffer'); 5 | 6 | var useUint8Array = typeof Uint8Array !== 'undefined'; 7 | var useArrayBuffer = useUint8Array && typeof ArrayBuffer !== 'undefined'; 8 | var isView = useArrayBuffer && ArrayBuffer.isView; 9 | 10 | module.exports = function (thing, encoding) { 11 | if ( 12 | typeof thing === 'string' 13 | || Buffer.isBuffer(thing) 14 | || (useUint8Array && thing instanceof Uint8Array) 15 | || (isView && isView(thing)) 16 | ) { 17 | return toBuffer(thing, encoding); 18 | } 19 | throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView'); 20 | }; 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kirill Fomichev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hash-base 2 | 3 | [![npm Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base) 4 | [![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) 5 | [![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) 6 | 7 | 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]). 8 | 9 | ## Example 10 | 11 | ```js 12 | const HashBase = require('hash-base'); 13 | const inherits = require('inherits'); 14 | 15 | // our hash function is XOR sum of all bytes 16 | function MyHash () { 17 | HashBase.call(this, 1); // in bytes 18 | 19 | this._sum = 0x00; 20 | }; 21 | 22 | inherits(MyHash, HashBase) 23 | 24 | MyHash.prototype._update = function () { 25 | for (let i = 0; i < this._block.length; ++i) { 26 | this._sum ^= this._block[i]; 27 | } 28 | }; 29 | 30 | MyHash.prototype._digest = function () { 31 | return this._sum; 32 | }; 33 | 34 | const data = Buffer.from([0x00, 0x42, 0x01]); 35 | const hash = new MyHash().update(data).digest(); 36 | console.log(hash); // => 67 37 | ``` 38 | You also can check [source code](index.js) or [crypto-browserify/md5.js][5] 39 | 40 | ## LICENSE 41 | 42 | MIT 43 | 44 | [1]: https://nodejs.org/api/crypto.html#crypto_class_hash 45 | [2]: https://nodejs.org/api/crypto.html#crypto_class_cipher 46 | [3]: https://nodejs.org/api/crypto.html#crypto_class_decipher 47 | [4]: https://github.com/crypto-browserify/cipher-base 48 | [5]: https://github.com/crypto-browserify/md5.js 49 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hash-base", 3 | "version": "3.1.2", 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 (https://github.com/fanatid)", 15 | "main": "index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/crypto-browserify/hash-base.git" 19 | }, 20 | "scripts": { 21 | "prepack": "npmignore --auto --commentLines=autogenerated", 22 | "lint": "eslint --ext=js,mjs .", 23 | "pretest": "npm run lint", 24 | "test": "npm run tests-only", 25 | "tests-only": "nyc tape \"test/**/*.js\"", 26 | "posttest": "npx npm@\">=10.2\" audit --production", 27 | "version": "auto-changelog && git add CHANGELOG.md", 28 | "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" 29 | }, 30 | "dependencies": { 31 | "inherits": "^2.0.4", 32 | "readable-stream": "^2.3.8", 33 | "safe-buffer": "^5.2.1", 34 | "to-buffer": "^1.2.1" 35 | }, 36 | "devDependencies": { 37 | "@ljharb/eslint-config": "^21.2.0", 38 | "auto-changelog": "^2.5.0", 39 | "encoding": "^0.1.13", 40 | "eslint": "=8.8.0", 41 | "npmignore": "^0.3.1", 42 | "nyc": "^10.3.2", 43 | "tape": "^5.9.0" 44 | }, 45 | "engines": { 46 | "node": ">= 0.8" 47 | }, 48 | "publishConfig": { 49 | "ignore": [ 50 | ".github/workflows", 51 | ".eslintrc", 52 | ".nycrc", 53 | "test" 54 | ] 55 | }, 56 | "auto-changelog": { 57 | "output": "CHANGELOG.md", 58 | "template": "keepachangelog", 59 | "unreleased": false, 60 | "commitLimit": false, 61 | "backfillLimit": false, 62 | "hideCredit": true 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Buffer = require('safe-buffer').Buffer; 4 | var toBuffer = require('./to-buffer'); 5 | var Transform = require('readable-stream').Transform; 6 | var inherits = require('inherits'); 7 | 8 | function HashBase(blockSize) { 9 | Transform.call(this); 10 | 11 | this._block = Buffer.allocUnsafe(blockSize); 12 | this._blockSize = blockSize; 13 | this._blockOffset = 0; 14 | this._length = [0, 0, 0, 0]; 15 | 16 | this._finalized = false; 17 | } 18 | 19 | inherits(HashBase, Transform); 20 | 21 | HashBase.prototype._transform = function (chunk, encoding, callback) { 22 | var error = null; 23 | try { 24 | this.update(chunk, encoding); 25 | } catch (err) { 26 | error = err; 27 | } 28 | 29 | callback(error); 30 | }; 31 | 32 | HashBase.prototype._flush = function (callback) { 33 | var error = null; 34 | try { 35 | this.push(this.digest()); 36 | } catch (err) { 37 | error = err; 38 | } 39 | 40 | callback(error); 41 | }; 42 | 43 | HashBase.prototype.update = function (data, encoding) { 44 | if (this._finalized) { 45 | throw new Error('Digest already called'); 46 | } 47 | 48 | var dataBuffer = toBuffer(data, encoding); // asserts correct input type 49 | 50 | // consume data 51 | var block = this._block; 52 | var offset = 0; 53 | while (this._blockOffset + dataBuffer.length - offset >= this._blockSize) { 54 | for (var i = this._blockOffset; i < this._blockSize;) { 55 | block[i] = dataBuffer[offset]; 56 | i += 1; 57 | offset += 1; 58 | } 59 | this._update(); 60 | this._blockOffset = 0; 61 | } 62 | while (offset < dataBuffer.length) { 63 | block[this._blockOffset] = dataBuffer[offset]; 64 | this._blockOffset += 1; 65 | offset += 1; 66 | } 67 | 68 | // update length 69 | for (var j = 0, carry = dataBuffer.length * 8; carry > 0; ++j) { 70 | this._length[j] += carry; 71 | carry = (this._length[j] / 0x0100000000) | 0; 72 | if (carry > 0) { 73 | this._length[j] -= 0x0100000000 * carry; 74 | } 75 | } 76 | 77 | return this; 78 | }; 79 | 80 | HashBase.prototype._update = function () { 81 | throw new Error('_update is not implemented'); 82 | }; 83 | 84 | HashBase.prototype.digest = function (encoding) { 85 | if (this._finalized) { 86 | throw new Error('Digest already called'); 87 | } 88 | this._finalized = true; 89 | 90 | var digest = this._digest(); 91 | if (encoding !== undefined) { 92 | digest = digest.toString(encoding); 93 | } 94 | 95 | // reset state 96 | this._block.fill(0); 97 | this._blockOffset = 0; 98 | for (var i = 0; i < 4; ++i) { 99 | this._length[i] = 0; 100 | } 101 | 102 | return digest; 103 | }; 104 | 105 | HashBase.prototype._digest = function () { 106 | throw new Error('_digest is not implemented'); 107 | }; 108 | 109 | module.exports = HashBase; 110 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var test = require('tape'); 4 | var HashBase = require('../'); 5 | var Buffer = require('safe-buffer').Buffer; 6 | 7 | var utf8text = 'УТФ-8 text'; 8 | var utf8buf = Buffer.from(utf8text, 'utf8'); 9 | function noop() {} 10 | 11 | test('HashBase#_transform', function (t) { 12 | t.test('should use HashBase#update', function (st) { 13 | st.plan(3); 14 | var base = new HashBase(64); 15 | base.update = function () { 16 | st.same(arguments[0], utf8text); 17 | st.same(arguments[1], 'utf8'); 18 | }; 19 | base._transform(utf8text, 'utf8', function (err) { 20 | st.same(err, null); 21 | }); 22 | 23 | st.end(); 24 | }); 25 | 26 | t.test('should handle error in HashBase#update', function (st) { 27 | st.plan(1); 28 | var err = new Error('hey'); 29 | var base = new HashBase(64); 30 | base.update = function () { throw err; }; 31 | base._transform(Buffer.allocUnsafe(0), 'buffer', function (_err) { 32 | st['true'](_err === err); 33 | }); 34 | 35 | st.end(); 36 | }); 37 | 38 | t.end(); 39 | }); 40 | 41 | test('HashBase#_flush', function (t) { 42 | t.test('should use HashBase#digest', function (st) { 43 | st.plan(2); 44 | var buffer = Buffer.allocUnsafe(0); 45 | var base = new HashBase(64); 46 | base.push = function (data) { st['true'](data === buffer); }; 47 | base.digest = function () { return buffer; }; 48 | base._flush(function (err) { st.same(err, null); }); 49 | 50 | st.end(); 51 | }); 52 | 53 | t.test('should handle errors in HashBase#digest', function (st) { 54 | st.plan(1); 55 | var base = new HashBase(64); 56 | var err = new Error('hey'); 57 | base.digest = function () { throw err; }; 58 | base._flush(function (_err) { st['true'](_err === err); }); 59 | 60 | st.end(); 61 | }); 62 | 63 | t.end(); 64 | }); 65 | 66 | test('HashBase#update', function (t) { 67 | t.test('only string or buffer is allowed', function (st) { 68 | var base = new HashBase(64); 69 | st['throws'](function () { 70 | base.update(null); 71 | }, /^TypeError: The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView$/); 72 | st.end(); 73 | }); 74 | 75 | t.test('should throw error after HashBase#digest', function (st) { 76 | var base = new HashBase(64); 77 | base._digest = noop; 78 | base.digest(); 79 | st['throws'](function () { 80 | base.update(''); 81 | }, /^Error: Digest already called$/); 82 | st.end(); 83 | }); 84 | 85 | t.test('should use HashBase#_update', function (st) { 86 | st.plan(1); 87 | 88 | var base = new HashBase(64); 89 | base._update = st.pass; 90 | base.update(Buffer.allocUnsafe(64)); 91 | 92 | st.end(); 93 | }); 94 | 95 | t.test('default encoding is utf8', function (st) { 96 | st.plan(1); 97 | 98 | var buffer = Buffer.allocUnsafe(64); 99 | buffer.fill(0); 100 | utf8buf.copy(buffer); 101 | var base = new HashBase(64); 102 | base._update = function () { st.same(this._block, buffer); }; 103 | base.update(buffer.toString('utf8')); 104 | 105 | st.end(); 106 | }); 107 | 108 | t.test('decode string with custom encoding', function (st) { 109 | st.plan(1); 110 | var buffer = Buffer.allocUnsafe(64); 111 | buffer.fill(0x42); 112 | var base = new HashBase(64); 113 | base._update = function () { st.same(this._block, buffer); }; 114 | base.update(buffer.toString('hex'), 'hex'); 115 | 116 | st.end(); 117 | }); 118 | 119 | t.test('data length is more than 2^32 bits', function (st) { 120 | var base = new HashBase(64); 121 | base._length = [Math.pow(2, 32) - 1, 0, 0, 0]; 122 | base.update(Buffer.allocUnsafe(1)); 123 | st.same(base._length, [7, 1, 0, 0]); 124 | 125 | st.end(); 126 | }); 127 | 128 | t.test('should return `this`', function (st) { 129 | var base = new HashBase(64); 130 | st.same(base.update(Buffer.allocUnsafe(0)), base); 131 | 132 | st.end(); 133 | }); 134 | 135 | t.test( 136 | 'handle UInt16Array', 137 | { 138 | skip: (ArrayBuffer.isView && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT)) 139 | || 'ArrayBuffer.isView and TypedArray fully supported' 140 | }, 141 | function (st) { 142 | var base = new HashBase(64); 143 | 144 | base._update = noop; 145 | base.update(new Uint16Array([1234, 512])); 146 | st.same(base._block.slice(0, base._blockOffset), Buffer.from('d2040002', 'hex')); 147 | 148 | st.end(); 149 | } 150 | ); 151 | 152 | t.end(); 153 | }); 154 | 155 | test('HashBase#_update', function (t) { 156 | t.test('is not implemented', function (st) { 157 | var base = new HashBase(64); 158 | st['throws'](function () { 159 | base._update(); 160 | }, /^Error: _update is not implemented$/); 161 | st.end(); 162 | }); 163 | 164 | t.end(); 165 | }); 166 | 167 | test('HashBase#digest', function (t) { 168 | t.test('should throw error on second call', function (st) { 169 | var base = new HashBase(64); 170 | base._digest = noop; 171 | base.digest(); 172 | st['throws'](function () { 173 | base.digest(); 174 | }, /^Error: Digest already called$/); 175 | st.end(); 176 | }); 177 | 178 | t.test('should use HashBase#_digest', function (st) { 179 | st.plan(1); 180 | 181 | var base = new HashBase(64); 182 | base._digest = st.pass; 183 | base.digest(); 184 | 185 | st.end(); 186 | }); 187 | 188 | t.test('should return buffer by default', function (st) { 189 | var base = new HashBase(64); 190 | 191 | base._digest = function () { return utf8buf; }; 192 | st.same(base.digest(), utf8buf); 193 | 194 | st.end(); 195 | }); 196 | 197 | t.test('should encode result with custom encoding', function (st) { 198 | var base = new HashBase(64); 199 | base._digest = function () { return utf8buf; }; 200 | st.same(base.digest('utf8'), utf8text); 201 | 202 | st.end(); 203 | }); 204 | 205 | t.end(); 206 | }); 207 | 208 | test('HashBase#_digest', function (t) { 209 | t.test('is not implemented', function (st) { 210 | var base = new HashBase(64); 211 | st['throws'](function () { 212 | base._digest(); 213 | }, /^Error: _digest is not implemented$/); 214 | st.end(); 215 | }); 216 | 217 | t.end(); 218 | }); 219 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [v3.1.2](https://github.com/browserify/hash-base/compare/v3.1.1...v3.1.2) - 2025-09-22 9 | 10 | ### Commits 11 | 12 | - [fix] package already works in node 0.8 [`1c19201`](https://github.com/browserify/hash-base/commit/1c1920112ef4baa65085b08ada90b4d0a83b69f2) 13 | - [Dev Deps] add missing peer dep [`7ac34b6`](https://github.com/browserify/hash-base/commit/7ac34b6011fb02b7a8261ee35f01fe8828218dda) 14 | 15 | ## [v3.1.1](https://github.com/browserify/hash-base/compare/v3.1.0...v3.1.1) - 2025-09-22 16 | 17 | ### Commits 18 | 19 | - [eslint] switch to eslint [`d63bf3b`](https://github.com/browserify/hash-base/commit/d63bf3b65c911e0de091918b7d331c6cf413567e) 20 | - [meta] add `auto-changelog` [`b2c7408`](https://github.com/browserify/hash-base/commit/b2c74084f744d090a1c59d2f8326a639409281f2) 21 | - [Tests] avoid tape-mutating beforeEach nonsense [`bb1f9b6`](https://github.com/browserify/hash-base/commit/bb1f9b6492acd97fd02acca575dcb334888b6fbb) 22 | - [Tests] avoid tape-mutating beforeEach nonsense [`ae228cd`](https://github.com/browserify/hash-base/commit/ae228cd0e9421fcca4c7e9e41b5451fa7ad74c73) 23 | - [readme] clean up formatting [`fd5cb3d`](https://github.com/browserify/hash-base/commit/fd5cb3d73a9be7617b6af647dd775ede7f5dab24) 24 | - [readme] clean up formatting [`a13ed61`](https://github.com/browserify/hash-base/commit/a13ed61331879e342435e71569a49061fdf1889c) 25 | - [Tests] migrate from travis to GHA [`9e2c04c`](https://github.com/browserify/hash-base/commit/9e2c04c435c25363fbe1f1fea8b32390f3f623b7) 26 | - [Tests] migrate from travis to GHA [`31766d4`](https://github.com/browserify/hash-base/commit/31766d413a21e534c96e6e562174f74b3d0368ca) 27 | - [Fix] return valid values on multi-byte-wide TypedArray input [`1af18ee`](https://github.com/browserify/hash-base/commit/1af18ee40d747bc177fba2cb89b4e937e3bd0724) 28 | - [Refactor] use `to-buffer` [`41d738b`](https://github.com/browserify/hash-base/commit/41d738bca2c5fa97c09bed9cdc7b2f3d8f1f9958) 29 | - [Dev Deps] update `tape`, downgrade `nyc`, clean up scripts [`13d373c`](https://github.com/browserify/hash-base/commit/13d373c1b06ed0a20db0fe158def49a7abf6a85b) 30 | - [Dev Deps] update `tape`, downgrade `nyc`, clean up scripts [`84f4fab`](https://github.com/browserify/hash-base/commit/84f4fab691c35591f44b1781311de10fc6f76b16) 31 | - [meta] use `npmignore` [`ecdd9a3`](https://github.com/browserify/hash-base/commit/ecdd9a312e26f81d6a84256d8bcdbf4427f84490) 32 | - Merge tag 'v3.0.5' [`d59c766`](https://github.com/browserify/hash-base/commit/d59c766986d962868457d05299fe111323dedd6f) 33 | - Only apps should have lockfiles [`de3ce83`](https://github.com/browserify/hash-base/commit/de3ce831c7f61a2ca3448f639d7b8ebe6b7b27ab) 34 | - Only apps should have lockfiles [`05b7504`](https://github.com/browserify/hash-base/commit/05b7504d4038fdf380e5c3227ee0719df12f5bda) 35 | - [Deps] update `inherits`, `safe-buffer` [`2b8687d`](https://github.com/browserify/hash-base/commit/2b8687d89f8e9de6c21bc277b147e76507ba74a6) 36 | - [Deps] update `safe-buffer`; downgrade `readable-stream` [`523da5d`](https://github.com/browserify/hash-base/commit/523da5dbfcef879a5c6967978cd4d39946f20c5a) 37 | - [Tests] clean up linting [`4274b7c`](https://github.com/browserify/hash-base/commit/4274b7cc9608712652e56091efcf5c66151be418) 38 | - [Tests] in node 0.10, Buffer `.fill` returns `undefined` [`0fdfd67`](https://github.com/browserify/hash-base/commit/0fdfd676fc51987e5d93f17858cc0f740b56b6af) 39 | - [Tests] in node 0.10, Buffer `.fill` returns `undefined` [`5d1f911`](https://github.com/browserify/hash-base/commit/5d1f91153a0c8365e970e0f9a4fde2fd901bb446) 40 | - [Fix] restore `engines.node` from 3.0.0 [`8cbfd12`](https://github.com/browserify/hash-base/commit/8cbfd123b307d51b6588718baa2c343dddf13fa4) 41 | - [Fix] restore `engines.node` from 3.0.0 [`b99d8a1`](https://github.com/browserify/hash-base/commit/b99d8a1ce428683c93ac005ea01e48f77ce005db) 42 | - [Tests] use `safe-buffer` in tests, too [`84bdfe9`](https://github.com/browserify/hash-base/commit/84bdfe944f46edbcaffed7b48567faf460f13bb8) 43 | - [Tests] use `safe-buffer` in tests, too [`9182f82`](https://github.com/browserify/hash-base/commit/9182f823b7f365189116a4582fa906f8fb008ab6) 44 | 45 | ## [v3.1.0](https://github.com/browserify/hash-base/compare/v3.0.5...v3.1.0) - 2020-05-01 46 | 47 | ### Merged 48 | 49 | - Update deps, add readable-stream [`#14`](https://github.com/browserify/hash-base/pull/14) 50 | 51 | ## [v3.0.5](https://github.com/browserify/hash-base/compare/v3.0.4...v3.0.5) - 2024-11-23 52 | 53 | ### Commits 54 | 55 | - [Tests] avoid tape-mutating beforeEach nonsense [`ae228cd`](https://github.com/browserify/hash-base/commit/ae228cd0e9421fcca4c7e9e41b5451fa7ad74c73) 56 | - [readme] clean up formatting [`a13ed61`](https://github.com/browserify/hash-base/commit/a13ed61331879e342435e71569a49061fdf1889c) 57 | - [Tests] migrate from travis to GHA [`31766d4`](https://github.com/browserify/hash-base/commit/31766d413a21e534c96e6e562174f74b3d0368ca) 58 | - [Fix] return valid values on multi-byte-wide TypedArray input [`1af18ee`](https://github.com/browserify/hash-base/commit/1af18ee40d747bc177fba2cb89b4e937e3bd0724) 59 | - [Dev Deps] update `tape`, downgrade `nyc`, clean up scripts [`13d373c`](https://github.com/browserify/hash-base/commit/13d373c1b06ed0a20db0fe158def49a7abf6a85b) 60 | - Only apps should have lockfiles [`de3ce83`](https://github.com/browserify/hash-base/commit/de3ce831c7f61a2ca3448f639d7b8ebe6b7b27ab) 61 | - [Deps] update `inherits`, `safe-buffer` [`2b8687d`](https://github.com/browserify/hash-base/commit/2b8687d89f8e9de6c21bc277b147e76507ba74a6) 62 | - [Tests] clean up linting [`4274b7c`](https://github.com/browserify/hash-base/commit/4274b7cc9608712652e56091efcf5c66151be418) 63 | - [Tests] in node 0.10, Buffer `.fill` returns `undefined` [`5d1f911`](https://github.com/browserify/hash-base/commit/5d1f91153a0c8365e970e0f9a4fde2fd901bb446) 64 | - [Fix] restore `engines.node` from 3.0.0 [`8cbfd12`](https://github.com/browserify/hash-base/commit/8cbfd123b307d51b6588718baa2c343dddf13fa4) 65 | - [Tests] use `safe-buffer` in tests, too [`9182f82`](https://github.com/browserify/hash-base/commit/9182f823b7f365189116a4582fa906f8fb008ab6) 66 | 67 | ## [v3.0.4](https://github.com/browserify/hash-base/compare/v3.0.3...v3.0.4) - 2017-05-24 68 | 69 | ### Merged 70 | 71 | - use safe-buffer [`#12`](https://github.com/browserify/hash-base/pull/12) 72 | - Only Node v4 or greater [Buffer only] [`#11`](https://github.com/browserify/hash-base/pull/11) 73 | - Reset state after #_digest [`#10`](https://github.com/browserify/hash-base/pull/10) 74 | 75 | ### Commits 76 | 77 | - Improve tests [`b20d350`](https://github.com/browserify/hash-base/commit/b20d3509f1d3b79f68bd9cd330938ca6472b9aa5) 78 | - Only Node v4 or greater [`8e24ac9`](https://github.com/browserify/hash-base/commit/8e24ac9258a1c9294960ee24820eed7494c38e10) 79 | - Real example in README [`71fc5bb`](https://github.com/browserify/hash-base/commit/71fc5bb4ac98a837bc68a34b58aa668e88031a33) 80 | - Typecheck as function [`867095d`](https://github.com/browserify/hash-base/commit/867095d2d7d369d1c24a44d64bdf403ecb1dd653) 81 | - Reset state after HashBase#_digest [`1a4298c`](https://github.com/browserify/hash-base/commit/1a4298c9401597c5e632b29a653ca88d965ae2b2) 82 | - Update devdependencies [`3b46138`](https://github.com/browserify/hash-base/commit/3b46138ad6779cc7f50b4ab3a4a93c7c84cf9dda) 83 | - Add node7 to travis [`3d29655`](https://github.com/browserify/hash-base/commit/3d29655b7add9008e88f76f4acb5bfe77df7833e) 84 | - Fix example in README [`89cdcd8`](https://github.com/browserify/hash-base/commit/89cdcd885a0473b9b6109d6bf285baba8cbeea3f) 85 | 86 | ## [v3.0.3](https://github.com/browserify/hash-base/compare/v3.0.2...v3.0.3) - 2016-08-28 87 | 88 | ### Commits 89 | 90 | - Add LICENSE file [`3d998aa`](https://github.com/browserify/hash-base/commit/3d998aaa4e6fbacc86b1b0f28b6fb7a4e4398998) 91 | 92 | ## [v3.0.2](https://github.com/browserify/hash-base/compare/v3.0.1...v3.0.2) - 2016-08-25 93 | 94 | ### Commits 95 | 96 | - Remove extra check [`bd13db2`](https://github.com/browserify/hash-base/commit/bd13db2156ce1fa56ddfc7931ef034aebf693903) 97 | 98 | ## [v3.0.1](https://github.com/browserify/hash-base/compare/v3.0.0...v3.0.1) - 2016-08-09 99 | 100 | ### Merged 101 | 102 | - Fix ._flush [`#7`](https://github.com/browserify/hash-base/pull/7) 103 | - Update nyc to version 7.0.0 🚀 [`#6`](https://github.com/browserify/hash-base/pull/6) 104 | 105 | ### Commits 106 | 107 | - Change ._digest to .digest in ._flush [`fdad9ad`](https://github.com/browserify/hash-base/commit/fdad9ad23f9a43f388123667e7ba917100e4fe3a) 108 | - Fix typo in README.md [`13264ec`](https://github.com/browserify/hash-base/commit/13264ec7adf25d68c3ff6a8a9a26f7e57282080f) 109 | - chore(package): update nyc to version 7.0.0 [`2a24e6a`](https://github.com/browserify/hash-base/commit/2a24e6a664bdd693dac080c81a903fb7548a89e4) 110 | 111 | ## [v3.0.0](https://github.com/browserify/hash-base/compare/v2.0.2...v3.0.0) - 2016-05-04 112 | 113 | ### Merged 114 | 115 | - utf8 as default encoding [`#4`](https://github.com/browserify/hash-base/pull/4) 116 | - Update standard to version 7.0.0 🚀 [`#5`](https://github.com/browserify/hash-base/pull/5) 117 | 118 | ### Commits 119 | 120 | - chore(package): update standard to version 7.0.0 [`0720515`](https://github.com/browserify/hash-base/commit/0720515b0fa865bdbf772ea07a84c13e6f4db717) 121 | 122 | ## [v2.0.2](https://github.com/browserify/hash-base/compare/v2.0.1...v2.0.2) - 2016-04-17 123 | 124 | ### Commits 125 | 126 | - Add type checking in .update [`96acf4a`](https://github.com/browserify/hash-base/commit/96acf4a5650fceb9dbaaba9873805a5c9d71eb88) 127 | - Normalize encoding in tests (utf-8 to utf8) [`0bb7c88`](https://github.com/browserify/hash-base/commit/0bb7c8871b177230c83ef27523812590a22ad6b4) 128 | 129 | ## [v2.0.1](https://github.com/browserify/hash-base/compare/v2.0.0...v2.0.1) - 2016-04-14 130 | 131 | ### Commits 132 | 133 | - Use this._block as local variable [`aa8bab9`](https://github.com/browserify/hash-base/commit/aa8bab94e5d2a905c1abd913684fc00ae6db7a69) 134 | - Change Math.floor to |0 [`24f7bb5`](https://github.com/browserify/hash-base/commit/24f7bb573e4b9d2d3a8851fa72ed446a5df05960) 135 | 136 | ## [v2.0.0](https://github.com/browserify/hash-base/compare/v1.0.2...v2.0.0) - 2016-04-07 137 | 138 | ### Fixed 139 | 140 | - (Closes #3) remove DEFAULT_ENCODING [`#3`](https://github.com/browserify/hash-base/issues/3) 141 | 142 | ### Commits 143 | 144 | - Add blocks handling [`0c8fb67`](https://github.com/browserify/hash-base/commit/0c8fb676e7d15af1fb7d441a7b9d783c17da5d08) 145 | - (#1) rename _initialized to _finalized [`ea3c00f`](https://github.com/browserify/hash-base/commit/ea3c00fdf768f68313e07f1d93652316f94d9de9) 146 | - Fix code style [`964daa5`](https://github.com/browserify/hash-base/commit/964daa56acf87439b229ee4582cc29f4b6f3a722) 147 | - Rename initialised_ to _initialised [`6e458c6`](https://github.com/browserify/hash-base/commit/6e458c69f9cf124758f68a01a8232fc7c3269945) 148 | 149 | ## [v1.0.2](https://github.com/browserify/hash-base/compare/v1.0.1...v1.0.2) - 2016-04-04 150 | 151 | ### Commits 152 | 153 | - Update should return hash instance [`59fef2b`](https://github.com/browserify/hash-base/commit/59fef2bc3b417aac5563022bcc928d1ae8161ee9) 154 | 155 | ## [v1.0.1](https://github.com/browserify/hash-base/compare/v1.0.0...v1.0.1) - 2016-04-04 156 | 157 | ### Commits 158 | 159 | - Throw error on second call digest [`f0b4caf`](https://github.com/browserify/hash-base/commit/f0b4cafb0a87e8bd3c22a6a3b31e323926dc4e63) 160 | - Update README.md [`6ca4555`](https://github.com/browserify/hash-base/commit/6ca4555d3be194f31725ebf21569d759e0bb9b74) 161 | 162 | ## v1.0.0 - 2016-04-03 163 | 164 | ### Commits 165 | 166 | - Initial commit [`e315bd2`](https://github.com/browserify/hash-base/commit/e315bd2c5c9e98ecac9a45bb5af1c38d87c3bc47) 167 | --------------------------------------------------------------------------------