aboutsummaryrefslogtreecommitdiff
path: root/node_modules/hash-base
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/hash-base
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
downloadwallet-core-cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585.tar.xz
remove node_modules
Diffstat (limited to 'node_modules/hash-base')
-rw-r--r--node_modules/hash-base/README.md48
-rw-r--r--node_modules/hash-base/index.js95
-rw-r--r--node_modules/hash-base/package.json41
3 files changed, 0 insertions, 184 deletions
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 <fanatid@ya.ru> (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"
- }
-}