summaryrefslogtreecommitdiffstats
path: root/node_modules/pbkdf2
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/pbkdf2')
-rw-r--r--node_modules/pbkdf2/LICENSE21
-rw-r--r--node_modules/pbkdf2/README.md30
-rw-r--r--node_modules/pbkdf2/browser.js2
-rw-r--r--node_modules/pbkdf2/index.js38
-rw-r--r--node_modules/pbkdf2/lib/async.js102
-rw-r--r--node_modules/pbkdf2/lib/default-encoding.js12
-rw-r--r--node_modules/pbkdf2/lib/precondition.js19
-rw-r--r--node_modules/pbkdf2/lib/sync-browser.js105
-rw-r--r--node_modules/pbkdf2/lib/sync.js52
-rw-r--r--node_modules/pbkdf2/lib/to-buffer.js13
-rw-r--r--node_modules/pbkdf2/package.json98
11 files changed, 0 insertions, 492 deletions
diff --git a/node_modules/pbkdf2/LICENSE b/node_modules/pbkdf2/LICENSE
deleted file mode 100644
index a115b52..0000000
--- a/node_modules/pbkdf2/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Daniel Cousens
-
-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/pbkdf2/README.md b/node_modules/pbkdf2/README.md
deleted file mode 100644
index 614934f..0000000
--- a/node_modules/pbkdf2/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# pbkdf2
-
-[![NPM Package](https://img.shields.io/npm/v/pbkdf2.svg?style=flat-square)](https://www.npmjs.org/package/pbkdf2)
-[![Build Status](https://img.shields.io/travis/crypto-browserify/pbkdf2.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/pbkdf2)
-[![Dependency status](https://img.shields.io/david/crypto-browserify/pbkdf2.svg?style=flat-square)](https://david-dm.org/crypto-browserify/pbkdf2#info=dependencies)
-
-[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
-
-This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from `crypto.getHashes()`
-
-
-## Usage
-
-```js
-var pbkdf2 = require('pbkdf2')
-var derivedKey = pbkdf2.pbkdf2Sync('password', 'salt', 1, 32, 'sha512')
-
-...
-```
-
-For more information on the API, please see the relevant [Node documentation](https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback).
-
-For high performance, use the `async` variant (`pbkdf2.pbkdf2`), not `pbkdf2.pbkdf2Sync`, this variant has the oppurtunity to use `window.crypto.subtle` when browserified.
-
-
-## Credits
-
-This module is a derivative of [cryptocoinjs/pbkdf2-sha256](https://github.com/cryptocoinjs/pbkdf2-sha256/), so thanks to [JP Richardson](https://github.com/jprichardson/) for laying the ground work.
-
-Thank you to [FangDun Cai](https://github.com/fundon) for donating the package name on npm, if you're looking for his previous module it is located at [fundon/pbkdf2](https://github.com/fundon/pbkdf2).
diff --git a/node_modules/pbkdf2/browser.js b/node_modules/pbkdf2/browser.js
deleted file mode 100644
index ac5fdd8..0000000
--- a/node_modules/pbkdf2/browser.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.pbkdf2 = require('./lib/async')
-exports.pbkdf2Sync = require('./lib/sync')
diff --git a/node_modules/pbkdf2/index.js b/node_modules/pbkdf2/index.js
deleted file mode 100644
index f170ea1..0000000
--- a/node_modules/pbkdf2/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-var native = require('crypto')
-
-var checkParameters = require('./lib/precondition')
-var defaultEncoding = require('./lib/default-encoding')
-var toBuffer = require('./lib/to-buffer')
-
-function nativePBKDF2 (password, salt, iterations, keylen, digest, callback) {
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
-
- if (typeof digest === 'function') {
- callback = digest
- digest = 'sha1'
- }
- if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
-
- return native.pbkdf2(password, salt, iterations, keylen, digest, callback)
-}
-
-function nativePBKDF2Sync (password, salt, iterations, keylen, digest) {
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
- digest = digest || 'sha1'
- return native.pbkdf2Sync(password, salt, iterations, keylen, digest)
-}
-
-/* istanbul ignore next */
-if (!native.pbkdf2Sync || native.pbkdf2Sync.toString().indexOf('keylen, digest') === -1) {
- exports.pbkdf2Sync = require('./lib/sync')
- exports.pbkdf2 = require('./lib/async')
-
-// native
-} else {
- exports.pbkdf2Sync = nativePBKDF2Sync
- exports.pbkdf2 = nativePBKDF2
-}
diff --git a/node_modules/pbkdf2/lib/async.js b/node_modules/pbkdf2/lib/async.js
deleted file mode 100644
index 9ef67c3..0000000
--- a/node_modules/pbkdf2/lib/async.js
+++ /dev/null
@@ -1,102 +0,0 @@
-var Buffer = require('safe-buffer').Buffer
-
-var checkParameters = require('./precondition')
-var defaultEncoding = require('./default-encoding')
-var sync = require('./sync')
-var toBuffer = require('./to-buffer')
-
-var ZERO_BUF
-var subtle = global.crypto && global.crypto.subtle
-var toBrowser = {
- sha: 'SHA-1',
- 'sha-1': 'SHA-1',
- sha1: 'SHA-1',
- sha256: 'SHA-256',
- 'sha-256': 'SHA-256',
- sha384: 'SHA-384',
- 'sha-384': 'SHA-384',
- 'sha-512': 'SHA-512',
- sha512: 'SHA-512'
-}
-var checks = []
-function checkNative (algo) {
- if (global.process && !global.process.browser) {
- return Promise.resolve(false)
- }
- if (!subtle || !subtle.importKey || !subtle.deriveBits) {
- return Promise.resolve(false)
- }
- if (checks[algo] !== undefined) {
- return checks[algo]
- }
- ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
- var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
- .then(function () {
- return true
- }).catch(function () {
- return false
- })
- checks[algo] = prom
- return prom
-}
-
-function browserPbkdf2 (password, salt, iterations, length, algo) {
- return subtle.importKey(
- 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
- ).then(function (key) {
- return subtle.deriveBits({
- name: 'PBKDF2',
- salt: salt,
- iterations: iterations,
- hash: {
- name: algo
- }
- }, key, length << 3)
- }).then(function (res) {
- return Buffer.from(res)
- })
-}
-
-function resolvePromise (promise, callback) {
- promise.then(function (out) {
- process.nextTick(function () {
- callback(null, out)
- })
- }, function (e) {
- process.nextTick(function () {
- callback(e)
- })
- })
-}
-module.exports = function (password, salt, iterations, keylen, digest, callback) {
- if (typeof digest === 'function') {
- callback = digest
- digest = undefined
- }
-
- digest = digest || 'sha1'
- var algo = toBrowser[digest.toLowerCase()]
-
- if (!algo || typeof global.Promise !== 'function') {
- return process.nextTick(function () {
- var out
- try {
- out = sync(password, salt, iterations, keylen, digest)
- } catch (e) {
- return callback(e)
- }
- callback(null, out)
- })
- }
-
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
- if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
-
- resolvePromise(checkNative(algo).then(function (resp) {
- if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
-
- return sync(password, salt, iterations, keylen, digest)
- }), callback)
-}
diff --git a/node_modules/pbkdf2/lib/default-encoding.js b/node_modules/pbkdf2/lib/default-encoding.js
deleted file mode 100644
index 4404fd2..0000000
--- a/node_modules/pbkdf2/lib/default-encoding.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var defaultEncoding
-/* istanbul ignore next */
-if (process.browser) {
- defaultEncoding = 'utf-8'
-} else if (process.version) {
- var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
-
- defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
-} else {
- defaultEncoding = 'utf-8'
-}
-module.exports = defaultEncoding
diff --git a/node_modules/pbkdf2/lib/precondition.js b/node_modules/pbkdf2/lib/precondition.js
deleted file mode 100644
index 0cac5b3..0000000
--- a/node_modules/pbkdf2/lib/precondition.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
-
-module.exports = function (iterations, keylen) {
- if (typeof iterations !== 'number') {
- throw new TypeError('Iterations not a number')
- }
-
- if (iterations < 0) {
- throw new TypeError('Bad iterations')
- }
-
- if (typeof keylen !== 'number') {
- throw new TypeError('Key length not a number')
- }
-
- if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
- throw new TypeError('Bad key length')
- }
-}
diff --git a/node_modules/pbkdf2/lib/sync-browser.js b/node_modules/pbkdf2/lib/sync-browser.js
deleted file mode 100644
index 20a64b4..0000000
--- a/node_modules/pbkdf2/lib/sync-browser.js
+++ /dev/null
@@ -1,105 +0,0 @@
-var md5 = require('create-hash/md5')
-var RIPEMD160 = require('ripemd160')
-var sha = require('sha.js')
-var Buffer = require('safe-buffer').Buffer
-
-var checkParameters = require('./precondition')
-var defaultEncoding = require('./default-encoding')
-var toBuffer = require('./to-buffer')
-
-var ZEROS = Buffer.alloc(128)
-var sizes = {
- md5: 16,
- sha1: 20,
- sha224: 28,
- sha256: 32,
- sha384: 48,
- sha512: 64,
- rmd160: 20,
- ripemd160: 20
-}
-
-function Hmac (alg, key, saltLen) {
- var hash = getDigest(alg)
- var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
-
- if (key.length > blocksize) {
- key = hash(key)
- } else if (key.length < blocksize) {
- key = Buffer.concat([key, ZEROS], blocksize)
- }
-
- var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
- var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
- for (var i = 0; i < blocksize; i++) {
- ipad[i] = key[i] ^ 0x36
- opad[i] = key[i] ^ 0x5C
- }
-
- var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
- ipad.copy(ipad1, 0, 0, blocksize)
- this.ipad1 = ipad1
- this.ipad2 = ipad
- this.opad = opad
- this.alg = alg
- this.blocksize = blocksize
- this.hash = hash
- this.size = sizes[alg]
-}
-
-Hmac.prototype.run = function (data, ipad) {
- data.copy(ipad, this.blocksize)
- var h = this.hash(ipad)
- h.copy(this.opad, this.blocksize)
- return this.hash(this.opad)
-}
-
-function getDigest (alg) {
- function shaFunc (data) {
- return sha(alg).update(data).digest()
- }
- function rmd160Func (data) {
- return new RIPEMD160().update(data).digest()
- }
-
- if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
- if (alg === 'md5') return md5
- return shaFunc
-}
-
-function pbkdf2 (password, salt, iterations, keylen, digest) {
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
-
- digest = digest || 'sha1'
-
- var hmac = new Hmac(digest, password, salt.length)
-
- var DK = Buffer.allocUnsafe(keylen)
- var block1 = Buffer.allocUnsafe(salt.length + 4)
- salt.copy(block1, 0, 0, salt.length)
-
- var destPos = 0
- var hLen = sizes[digest]
- var l = Math.ceil(keylen / hLen)
-
- for (var i = 1; i <= l; i++) {
- block1.writeUInt32BE(i, salt.length)
-
- var T = hmac.run(block1, hmac.ipad1)
- var U = T
-
- for (var j = 1; j < iterations; j++) {
- U = hmac.run(U, hmac.ipad2)
- for (var k = 0; k < hLen; k++) T[k] ^= U[k]
- }
-
- T.copy(DK, destPos)
- destPos += hLen
- }
-
- return DK
-}
-
-module.exports = pbkdf2
diff --git a/node_modules/pbkdf2/lib/sync.js b/node_modules/pbkdf2/lib/sync.js
deleted file mode 100644
index 9eeca48..0000000
--- a/node_modules/pbkdf2/lib/sync.js
+++ /dev/null
@@ -1,52 +0,0 @@
-var sizes = {
- md5: 16,
- sha1: 20,
- sha224: 28,
- sha256: 32,
- sha384: 48,
- sha512: 64,
- rmd160: 20,
- ripemd160: 20
-}
-
-var createHmac = require('create-hmac')
-var Buffer = require('safe-buffer').Buffer
-
-var checkParameters = require('./precondition')
-var defaultEncoding = require('./default-encoding')
-var toBuffer = require('./to-buffer')
-
-function pbkdf2 (password, salt, iterations, keylen, digest) {
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
-
- digest = digest || 'sha1'
-
- var DK = Buffer.allocUnsafe(keylen)
- var block1 = Buffer.allocUnsafe(salt.length + 4)
- salt.copy(block1, 0, 0, salt.length)
-
- var destPos = 0
- var hLen = sizes[digest]
- var l = Math.ceil(keylen / hLen)
-
- for (var i = 1; i <= l; i++) {
- block1.writeUInt32BE(i, salt.length)
-
- var T = createHmac(digest, password).update(block1).digest()
- var U = T
-
- for (var j = 1; j < iterations; j++) {
- U = createHmac(digest, password).update(U).digest()
- for (var k = 0; k < hLen; k++) T[k] ^= U[k]
- }
-
- T.copy(DK, destPos)
- destPos += hLen
- }
-
- return DK
-}
-
-module.exports = pbkdf2
diff --git a/node_modules/pbkdf2/lib/to-buffer.js b/node_modules/pbkdf2/lib/to-buffer.js
deleted file mode 100644
index ef0d4d4..0000000
--- a/node_modules/pbkdf2/lib/to-buffer.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var Buffer = require('safe-buffer').Buffer
-
-module.exports = function (thing, encoding, name) {
- if (Buffer.isBuffer(thing)) {
- return thing
- } else if (typeof thing === 'string') {
- return Buffer.from(thing, encoding)
- } else if (ArrayBuffer.isView(thing)) {
- return Buffer.from(thing.buffer)
- } else {
- throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')
- }
-}
diff --git a/node_modules/pbkdf2/package.json b/node_modules/pbkdf2/package.json
deleted file mode 100644
index 86d2c6f..0000000
--- a/node_modules/pbkdf2/package.json
+++ /dev/null
@@ -1,98 +0,0 @@
-{
- "_from": "pbkdf2@^3.0.3",
- "_id": "pbkdf2@3.1.1",
- "_inBundle": false,
- "_integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==",
- "_location": "/pbkdf2",
- "_phantomChildren": {},
- "_requested": {
- "type": "range",
- "registry": true,
- "raw": "pbkdf2@^3.0.3",
- "name": "pbkdf2",
- "escapedName": "pbkdf2",
- "rawSpec": "^3.0.3",
- "saveSpec": null,
- "fetchSpec": "^3.0.3"
- },
- "_requiredBy": [
- "/crypto-browserify",
- "/parse-asn1"
- ],
- "_resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz",
- "_shasum": "cb8724b0fada984596856d1a6ebafd3584654b94",
- "_spec": "pbkdf2@^3.0.3",
- "_where": "/home/pruss/Dev/3-minute-website/node_modules/crypto-browserify",
- "author": {
- "name": "Daniel Cousens"
- },
- "browser": {
- "./index.js": "./browser.js",
- "./lib/sync.js": "./lib/sync-browser.js"
- },
- "bugs": {
- "url": "https://github.com/crypto-browserify/pbkdf2/issues"
- },
- "bundleDependencies": false,
- "dependencies": {
- "create-hash": "^1.1.2",
- "create-hmac": "^1.1.4",
- "ripemd160": "^2.0.1",
- "safe-buffer": "^5.0.1",
- "sha.js": "^2.4.8"
- },
- "deprecated": false,
- "description": "This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from crypto.getHashes()",
- "devDependencies": {
- "benchmark": "^2.1.4",
- "browserify": "*",
- "nyc": "^6.4.0",
- "standard": "*",
- "tape": "^4.5.1"
- },
- "engines": {
- "node": ">=0.12"
- },
- "files": [
- "browser.js",
- "index.js",
- "lib/"
- ],
- "homepage": "https://github.com/crypto-browserify/pbkdf2",
- "keywords": [
- "pbkdf2",
- "kdf",
- "salt",
- "hash"
- ],
- "license": "MIT",
- "main": "index.js",
- "name": "pbkdf2",
- "nyc": {
- "exclude": [
- "lib/async.js",
- "test/bundle.js"
- ]
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/crypto-browserify/pbkdf2.git"
- },
- "scripts": {
- "bench": "node bench/",
- "bundle-test": "browserify test/index.js > test/bundle.js",
- "coverage": "nyc --check-coverage --branches 95 --functions 95 tape test/*.js",
- "coverage-html": "nyc report --reporter=html",
- "coverage-report": "nyc report --reporter=lcov",
- "lint": "standard",
- "prepublish": "npm run test",
- "test": "npm run lint && npm run unit",
- "unit": "tape test/*.js"
- },
- "standard": {
- "ignore": [
- "test/bundle.js"
- ]
- },
- "version": "3.1.1"
-}