diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/md5-hex | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) | |
download | wallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/md5-hex')
-rw-r--r-- | node_modules/md5-hex/browser.js | 10 | ||||
-rw-r--r-- | node_modules/md5-hex/index.js | 23 | ||||
-rw-r--r-- | node_modules/md5-hex/license | 21 | ||||
-rw-r--r-- | node_modules/md5-hex/package.json | 39 | ||||
-rw-r--r-- | node_modules/md5-hex/readme.md | 44 |
5 files changed, 137 insertions, 0 deletions
diff --git a/node_modules/md5-hex/browser.js b/node_modules/md5-hex/browser.js new file mode 100644 index 000000000..50b9b27cd --- /dev/null +++ b/node_modules/md5-hex/browser.js @@ -0,0 +1,10 @@ +'use strict'; +var md5OMatic = require('md5-o-matic'); + +module.exports = function (input) { + if (Array.isArray(input)) { + input = input.join(''); + } + + return md5OMatic(input); +}; diff --git a/node_modules/md5-hex/index.js b/node_modules/md5-hex/index.js new file mode 100644 index 000000000..c52bddd7c --- /dev/null +++ b/node_modules/md5-hex/index.js @@ -0,0 +1,23 @@ +'use strict'; +var crypto = require('crypto'); + +module.exports = function (input) { + var hash = crypto.createHash('md5'); + + var update = function (buf) { + var inputEncoding = typeof buf === 'string' ? 'utf8' : undefined; + hash.update(buf, inputEncoding); + }; + + if (arguments.length > 1) { + throw new Error('Too many arguments. Try specifying an array.'); + } + + if (Array.isArray(input)) { + input.forEach(update); + } else { + update(input); + } + + return hash.digest('hex'); +}; diff --git a/node_modules/md5-hex/license b/node_modules/md5-hex/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/md5-hex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/md5-hex/package.json b/node_modules/md5-hex/package.json new file mode 100644 index 000000000..9dc26627f --- /dev/null +++ b/node_modules/md5-hex/package.json @@ -0,0 +1,39 @@ +{ + "name": "md5-hex", + "version": "1.3.0", + "description": "Create a MD5 hash with hex encoding", + "license": "MIT", + "repository": "sindresorhus/md5-hex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "browser": "browser.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "browser.js" + ], + "keywords": [ + "hash", + "crypto", + "md5", + "hex", + "buffer", + "browser", + "browserify" + ], + "dependencies": { + "md5-o-matic": "^0.1.1" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/md5-hex/readme.md b/node_modules/md5-hex/readme.md new file mode 100644 index 000000000..df40a9415 --- /dev/null +++ b/node_modules/md5-hex/readme.md @@ -0,0 +1,44 @@ +# md5-hex [![Build Status](https://travis-ci.org/sindresorhus/md5-hex.svg?branch=master)](https://travis-ci.org/sindresorhus/md5-hex) + +> Create a MD5 hash with hex encoding + +*Please don't use MD5 hashes for anything sensitive!* + +Checkout [`hasha`](https://github.com/sindresorhus/hasha) if you need something more flexible. + + +## Install + +``` +$ npm install --save md5-hex +``` + + +## Usage + +```js +const fs = require('fs'); +const md5Hex = require('md5-hex'); +const buffer = fs.readFileSync('unicorn.png'); + +md5Hex(buffer); +//=> '1abcb33beeb811dca15f0ac3e47b88d9' +``` + + +## API + +### md5Hex(input) + +#### input + +Type: `buffer` `string` `array[string|buffer]` + +Prefer buffers as they're faster to hash, but strings can be useful for small things. + +Pass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) |