From cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 27 Mar 2019 21:01:33 +0100 Subject: remove node_modules --- node_modules/hash-base/README.md | 48 ------------------- node_modules/hash-base/index.js | 95 ------------------------------------- node_modules/hash-base/package.json | 41 ---------------- 3 files changed, 184 deletions(-) delete mode 100644 node_modules/hash-base/README.md delete mode 100644 node_modules/hash-base/index.js delete mode 100644 node_modules/hash-base/package.json (limited to 'node_modules/hash-base') diff --git a/node_modules/hash-base/README.md b/node_modules/hash-base/README.md deleted file mode 100644 index 83ae2edcc..000000000 --- a/node_modules/hash-base/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# hash-base - -[![NPM Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base) -[![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) -[![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) - -[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) - -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]). - -## Example - -```js -const HashBase = require('hash-base') -const inherits = require('inherits') - -// our hash function is XOR sum of all bytes -function MyHash () { - HashBase.call(this, 1) // in bytes - - this._sum = 0x00 -} - -inherits(MyHash, HashBase) - -MyHash.prototype._update = function () { - for (let i = 0; i < this._block.length; ++i) this._sum ^= this._block[i] -} - -MyHash.prototype._digest = function () { - return this._sum -} - -const data = Buffer.from([ 0x00, 0x42, 0x01 ]) -const hash = new MyHash().update(data).digest() -console.log(hash) // => 67 -``` -You also can check [source code](index.js) or [crypto-browserify/md5.js][5] - -## LICENSE - -MIT - -[1]: https://nodejs.org/api/crypto.html#crypto_class_hash -[2]: https://nodejs.org/api/crypto.html#crypto_class_cipher -[3]: https://nodejs.org/api/crypto.html#crypto_class_decipher -[4]: https://github.com/crypto-browserify/cipher-base -[5]: https://github.com/crypto-browserify/md5.js diff --git a/node_modules/hash-base/index.js b/node_modules/hash-base/index.js deleted file mode 100644 index bf788daa4..000000000 --- a/node_modules/hash-base/index.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict' -var Buffer = require('safe-buffer').Buffer -var Transform = require('stream').Transform -var inherits = require('inherits') - -function throwIfNotStringOrBuffer (val, prefix) { - if (!Buffer.isBuffer(val) && typeof val !== 'string') { - throw new TypeError(prefix + ' must be a string or a buffer') - } -} - -function HashBase (blockSize) { - Transform.call(this) - - this._block = Buffer.allocUnsafe(blockSize) - this._blockSize = blockSize - this._blockOffset = 0 - this._length = [0, 0, 0, 0] - - this._finalized = false -} - -inherits(HashBase, Transform) - -HashBase.prototype._transform = function (chunk, encoding, callback) { - var error = null - try { - this.update(chunk, encoding) - } catch (err) { - error = err - } - - callback(error) -} - -HashBase.prototype._flush = function (callback) { - var error = null - try { - this.push(this.digest()) - } catch (err) { - error = err - } - - callback(error) -} - -HashBase.prototype.update = function (data, encoding) { - throwIfNotStringOrBuffer(data, 'Data') - if (this._finalized) throw new Error('Digest already called') - if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) - - // consume data - var block = this._block - var offset = 0 - while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] - this._update() - this._blockOffset = 0 - } - while (offset < data.length) block[this._blockOffset++] = data[offset++] - - // update length - for (var j = 0, carry = data.length * 8; carry > 0; ++j) { - this._length[j] += carry - carry = (this._length[j] / 0x0100000000) | 0 - if (carry > 0) this._length[j] -= 0x0100000000 * carry - } - - return this -} - -HashBase.prototype._update = function () { - throw new Error('_update is not implemented') -} - -HashBase.prototype.digest = function (encoding) { - if (this._finalized) throw new Error('Digest already called') - this._finalized = true - - var digest = this._digest() - if (encoding !== undefined) digest = digest.toString(encoding) - - // reset state - this._block.fill(0) - this._blockOffset = 0 - for (var i = 0; i < 4; ++i) this._length[i] = 0 - - return digest -} - -HashBase.prototype._digest = function () { - throw new Error('_digest is not implemented') -} - -module.exports = HashBase diff --git a/node_modules/hash-base/package.json b/node_modules/hash-base/package.json deleted file mode 100644 index 0edf37d02..000000000 --- a/node_modules/hash-base/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "hash-base", - "version": "3.0.4", - "description": "abstract base class for hash-streams", - "keywords": [ - "hash", - "stream" - ], - "homepage": "https://github.com/crypto-browserify/hash-base", - "bugs": { - "url": "https://github.com/crypto-browserify/hash-base/issues" - }, - "license": "MIT", - "author": "Kirill Fomichev (https://github.com/fanatid)", - "files": [ - "index.js" - ], - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/crypto-browserify/hash-base.git" - }, - "scripts": { - "coverage": "nyc node test/*.js", - "lint": "standard", - "test": "npm run lint && npm run unit", - "unit": "node test/*.js" - }, - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "devDependencies": { - "nyc": "^8.3.2", - "standard": "*", - "tape": "^4.2.0" - }, - "engines": { - "node": ">=4" - } -} -- cgit v1.2.3