meteor-node-stubs 1.2.20 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@meteorjs/browserify-sign/node_modules/isarray/README.md +60 -0
- package/node_modules/@meteorjs/browserify-sign/node_modules/isarray/index.js +5 -0
- package/node_modules/@meteorjs/browserify-sign/node_modules/isarray/package.json +45 -0
- package/node_modules/isarray/LICENSE +21 -0
- package/node_modules/isarray/README.md +8 -30
- package/node_modules/isarray/package.json +4 -1
- package/node_modules/pbkdf2/node_modules/create-hash/.npmignore +1 -0
- package/node_modules/pbkdf2/node_modules/create-hash/.travis.yml +15 -0
- package/node_modules/pbkdf2/node_modules/create-hash/browser.js +52 -0
- package/node_modules/pbkdf2/node_modules/create-hash/index.js +1 -0
- package/node_modules/pbkdf2/node_modules/create-hash/make-hash.js +30 -0
- package/node_modules/pbkdf2/node_modules/create-hash/md5.js +151 -0
- package/node_modules/pbkdf2/node_modules/create-hash/package.json +37 -0
- package/node_modules/pbkdf2/node_modules/create-hash/readme.md +19 -0
- package/node_modules/pbkdf2/node_modules/create-hash/test.js +40 -0
- package/node_modules/pbkdf2/node_modules/hash-base/README.md +38 -0
- package/node_modules/pbkdf2/node_modules/hash-base/index.js +83 -0
- package/node_modules/pbkdf2/node_modules/hash-base/package.json +37 -0
- package/node_modules/pbkdf2/node_modules/ripemd160/CHANGELOG.md +72 -0
- package/node_modules/pbkdf2/node_modules/ripemd160/LICENSE.md +21 -0
- package/node_modules/pbkdf2/node_modules/ripemd160/README.md +27 -0
- package/node_modules/pbkdf2/node_modules/ripemd160/index.js +291 -0
- package/node_modules/pbkdf2/node_modules/ripemd160/package.json +37 -0
- package/node_modules/to-buffer/.eslintrc +16 -0
- package/node_modules/to-buffer/.github/FUNDING.yml +12 -0
- package/node_modules/to-buffer/.nycrc +9 -0
- package/node_modules/to-buffer/CHANGELOG.md +72 -0
- package/node_modules/to-buffer/LICENSE +21 -0
- package/node_modules/to-buffer/README.md +44 -0
- package/node_modules/to-buffer/index.js +109 -0
- package/node_modules/to-buffer/package.json +60 -0
- package/node_modules/typed-array-buffer/.eslintrc +13 -0
- package/node_modules/typed-array-buffer/.github/FUNDING.yml +12 -0
- package/node_modules/typed-array-buffer/.nycrc +13 -0
- package/node_modules/typed-array-buffer/CHANGELOG.md +50 -0
- package/node_modules/typed-array-buffer/LICENSE +21 -0
- package/node_modules/typed-array-buffer/README.md +42 -0
- package/node_modules/typed-array-buffer/index.d.ts +9 -0
- package/node_modules/typed-array-buffer/index.js +19 -0
- package/node_modules/typed-array-buffer/package.json +82 -0
- package/node_modules/typed-array-buffer/test/index.js +23 -0
- package/node_modules/typed-array-buffer/tsconfig.json +9 -0
- package/package.json +1 -1
- /package/node_modules/{isarray → @meteorjs/browserify-sign/node_modules/isarray}/.npmignore +0 -0
- /package/node_modules/{isarray → @meteorjs/browserify-sign/node_modules/isarray}/.travis.yml +0 -0
- /package/node_modules/{isarray → @meteorjs/browserify-sign/node_modules/isarray}/Makefile +0 -0
- /package/node_modules/{isarray → @meteorjs/browserify-sign/node_modules/isarray}/component.json +0 -0
- /package/node_modules/{isarray → @meteorjs/browserify-sign/node_modules/isarray}/test.js +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
# isarray
|
|
3
|
+
|
|
4
|
+
`Array#isArray` for older browsers.
|
|
5
|
+
|
|
6
|
+
[](http://travis-ci.org/juliangruber/isarray)
|
|
7
|
+
[](https://www.npmjs.org/package/isarray)
|
|
8
|
+
|
|
9
|
+
[
|
|
10
|
+
](https://ci.testling.com/juliangruber/isarray)
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
var isArray = require('isarray');
|
|
16
|
+
|
|
17
|
+
console.log(isArray([])); // => true
|
|
18
|
+
console.log(isArray({})); // => false
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
With [npm](http://npmjs.org) do
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
$ npm install isarray
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then bundle for the browser with
|
|
30
|
+
[browserify](https://github.com/substack/browserify).
|
|
31
|
+
|
|
32
|
+
With [component](http://component.io) do
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
$ component install juliangruber/isarray
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
(MIT)
|
|
41
|
+
|
|
42
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
43
|
+
|
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
45
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
46
|
+
the Software without restriction, including without limitation the rights to
|
|
47
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
48
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
49
|
+
so, subject to the following conditions:
|
|
50
|
+
|
|
51
|
+
The above copyright notice and this permission notice shall be included in all
|
|
52
|
+
copies or substantial portions of the Software.
|
|
53
|
+
|
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
55
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
56
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
57
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
58
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
59
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
60
|
+
SOFTWARE.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "isarray",
|
|
3
|
+
"description": "Array#isArray for older browsers",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git://github.com/juliangruber/isarray.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/juliangruber/isarray",
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"dependencies": {},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"tape": "~2.13.4"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"browser",
|
|
17
|
+
"isarray",
|
|
18
|
+
"array"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Julian Gruber",
|
|
22
|
+
"email": "mail@juliangruber.com",
|
|
23
|
+
"url": "http://juliangruber.com"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"testling": {
|
|
27
|
+
"files": "test.js",
|
|
28
|
+
"browsers": [
|
|
29
|
+
"ie/8..latest",
|
|
30
|
+
"firefox/17..latest",
|
|
31
|
+
"firefox/nightly",
|
|
32
|
+
"chrome/22..latest",
|
|
33
|
+
"chrome/canary",
|
|
34
|
+
"opera/12..latest",
|
|
35
|
+
"opera/next",
|
|
36
|
+
"safari/5.1..latest",
|
|
37
|
+
"ipad/6.0..latest",
|
|
38
|
+
"iphone/6.0..latest",
|
|
39
|
+
"android-browser/4.2..latest"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "tape test.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# isarray
|
|
3
3
|
|
|
4
|
-
`Array#isArray` for older browsers.
|
|
4
|
+
`Array#isArray` for older browsers and deprecated Node.js versions.
|
|
5
5
|
|
|
6
6
|
[](http://travis-ci.org/juliangruber/isarray)
|
|
7
7
|
[](https://www.npmjs.org/package/isarray)
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
[
|
|
10
10
|
](https://ci.testling.com/juliangruber/isarray)
|
|
11
11
|
|
|
12
|
+
__Just use Array.isArray directly__, unless you need to support those older versions.
|
|
13
|
+
|
|
12
14
|
## Usage
|
|
13
15
|
|
|
14
16
|
```js
|
|
@@ -20,41 +22,17 @@ console.log(isArray({})); // => false
|
|
|
20
22
|
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
23
|
-
With [npm](
|
|
25
|
+
With [npm](https://npmjs.org) do
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
28
|
$ npm install isarray
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
Then bundle for the browser with
|
|
30
|
-
[browserify](https://github.com/substack/browserify).
|
|
31
|
-
|
|
32
|
-
With [component](http://component.io) do
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
$ component install juliangruber/isarray
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## License
|
|
39
|
-
|
|
40
|
-
(MIT)
|
|
41
|
-
|
|
42
|
-
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
32
|
+
[browserify](https://github.com/substack/node-browserify).
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
46
|
-
the Software without restriction, including without limitation the rights to
|
|
47
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
48
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
49
|
-
so, subject to the following conditions:
|
|
34
|
+
## Sponsors
|
|
50
35
|
|
|
51
|
-
|
|
52
|
-
copies or substantial portions of the Software.
|
|
36
|
+
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
|
53
37
|
|
|
54
|
-
|
|
55
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
56
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
57
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
58
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
59
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
60
|
-
SOFTWARE.
|
|
38
|
+
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isarray",
|
|
3
3
|
"description": "Array#isArray for older browsers",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.5",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/juliangruber/isarray.git"
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://github.com/juliangruber/isarray",
|
|
10
10
|
"main": "index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js"
|
|
13
|
+
],
|
|
11
14
|
"dependencies": {},
|
|
12
15
|
"devDependencies": {
|
|
13
16
|
"tape": "~2.13.4"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
var inherits = require('inherits')
|
|
3
|
+
var md5 = require('./md5')
|
|
4
|
+
var RIPEMD160 = require('ripemd160')
|
|
5
|
+
var sha = require('sha.js')
|
|
6
|
+
|
|
7
|
+
var Base = require('cipher-base')
|
|
8
|
+
|
|
9
|
+
function HashNoConstructor (hash) {
|
|
10
|
+
Base.call(this, 'digest')
|
|
11
|
+
|
|
12
|
+
this._hash = hash
|
|
13
|
+
this.buffers = []
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
inherits(HashNoConstructor, Base)
|
|
17
|
+
|
|
18
|
+
HashNoConstructor.prototype._update = function (data) {
|
|
19
|
+
this.buffers.push(data)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
HashNoConstructor.prototype._final = function () {
|
|
23
|
+
var buf = Buffer.concat(this.buffers)
|
|
24
|
+
var r = this._hash(buf)
|
|
25
|
+
this.buffers = null
|
|
26
|
+
|
|
27
|
+
return r
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Hash (hash) {
|
|
31
|
+
Base.call(this, 'digest')
|
|
32
|
+
|
|
33
|
+
this._hash = hash
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
inherits(Hash, Base)
|
|
37
|
+
|
|
38
|
+
Hash.prototype._update = function (data) {
|
|
39
|
+
this._hash.update(data)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Hash.prototype._final = function () {
|
|
43
|
+
return this._hash.digest()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = function createHash (alg) {
|
|
47
|
+
alg = alg.toLowerCase()
|
|
48
|
+
if (alg === 'md5') return new HashNoConstructor(md5)
|
|
49
|
+
if (alg === 'rmd160' || alg === 'ripemd160') return new Hash(new RIPEMD160())
|
|
50
|
+
|
|
51
|
+
return new Hash(sha(alg))
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('crypto').createHash
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
var intSize = 4
|
|
3
|
+
var zeroBuffer = new Buffer(intSize)
|
|
4
|
+
zeroBuffer.fill(0)
|
|
5
|
+
|
|
6
|
+
var charSize = 8
|
|
7
|
+
var hashSize = 16
|
|
8
|
+
|
|
9
|
+
function toArray (buf) {
|
|
10
|
+
if ((buf.length % intSize) !== 0) {
|
|
11
|
+
var len = buf.length + (intSize - (buf.length % intSize))
|
|
12
|
+
buf = Buffer.concat([buf, zeroBuffer], len)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var arr = new Array(buf.length >>> 2)
|
|
16
|
+
for (var i = 0, j = 0; i < buf.length; i += intSize, j++) {
|
|
17
|
+
arr[j] = buf.readInt32LE(i)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return arr
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = function hash (buf, fn) {
|
|
24
|
+
var arr = fn(toArray(buf), buf.length * charSize)
|
|
25
|
+
buf = new Buffer(hashSize)
|
|
26
|
+
for (var i = 0; i < arr.length; i++) {
|
|
27
|
+
buf.writeInt32LE(arr[i], i << 2, true)
|
|
28
|
+
}
|
|
29
|
+
return buf
|
|
30
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/*
|
|
3
|
+
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
|
4
|
+
* Digest Algorithm, as defined in RFC 1321.
|
|
5
|
+
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
|
|
6
|
+
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
|
7
|
+
* Distributed under the BSD License
|
|
8
|
+
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var makeHash = require('./make-hash')
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Calculate the MD5 of an array of little-endian words, and a bit length
|
|
15
|
+
*/
|
|
16
|
+
function core_md5 (x, len) {
|
|
17
|
+
/* append padding */
|
|
18
|
+
x[len >> 5] |= 0x80 << ((len) % 32)
|
|
19
|
+
x[(((len + 64) >>> 9) << 4) + 14] = len
|
|
20
|
+
|
|
21
|
+
var a = 1732584193
|
|
22
|
+
var b = -271733879
|
|
23
|
+
var c = -1732584194
|
|
24
|
+
var d = 271733878
|
|
25
|
+
|
|
26
|
+
for (var i = 0; i < x.length; i += 16) {
|
|
27
|
+
var olda = a
|
|
28
|
+
var oldb = b
|
|
29
|
+
var oldc = c
|
|
30
|
+
var oldd = d
|
|
31
|
+
|
|
32
|
+
a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936)
|
|
33
|
+
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586)
|
|
34
|
+
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819)
|
|
35
|
+
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330)
|
|
36
|
+
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897)
|
|
37
|
+
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426)
|
|
38
|
+
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341)
|
|
39
|
+
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983)
|
|
40
|
+
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416)
|
|
41
|
+
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417)
|
|
42
|
+
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063)
|
|
43
|
+
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162)
|
|
44
|
+
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682)
|
|
45
|
+
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101)
|
|
46
|
+
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290)
|
|
47
|
+
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329)
|
|
48
|
+
|
|
49
|
+
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510)
|
|
50
|
+
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632)
|
|
51
|
+
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713)
|
|
52
|
+
b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302)
|
|
53
|
+
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691)
|
|
54
|
+
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083)
|
|
55
|
+
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335)
|
|
56
|
+
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848)
|
|
57
|
+
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438)
|
|
58
|
+
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690)
|
|
59
|
+
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961)
|
|
60
|
+
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501)
|
|
61
|
+
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467)
|
|
62
|
+
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784)
|
|
63
|
+
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473)
|
|
64
|
+
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734)
|
|
65
|
+
|
|
66
|
+
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558)
|
|
67
|
+
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463)
|
|
68
|
+
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562)
|
|
69
|
+
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556)
|
|
70
|
+
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060)
|
|
71
|
+
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353)
|
|
72
|
+
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632)
|
|
73
|
+
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640)
|
|
74
|
+
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174)
|
|
75
|
+
d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222)
|
|
76
|
+
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979)
|
|
77
|
+
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189)
|
|
78
|
+
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487)
|
|
79
|
+
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835)
|
|
80
|
+
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520)
|
|
81
|
+
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651)
|
|
82
|
+
|
|
83
|
+
a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844)
|
|
84
|
+
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415)
|
|
85
|
+
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905)
|
|
86
|
+
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055)
|
|
87
|
+
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571)
|
|
88
|
+
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606)
|
|
89
|
+
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523)
|
|
90
|
+
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799)
|
|
91
|
+
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359)
|
|
92
|
+
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744)
|
|
93
|
+
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380)
|
|
94
|
+
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649)
|
|
95
|
+
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070)
|
|
96
|
+
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379)
|
|
97
|
+
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259)
|
|
98
|
+
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551)
|
|
99
|
+
|
|
100
|
+
a = safe_add(a, olda)
|
|
101
|
+
b = safe_add(b, oldb)
|
|
102
|
+
c = safe_add(c, oldc)
|
|
103
|
+
d = safe_add(d, oldd)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return [a, b, c, d]
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* These functions implement the four basic operations the algorithm uses.
|
|
111
|
+
*/
|
|
112
|
+
function md5_cmn (q, a, b, x, s, t) {
|
|
113
|
+
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function md5_ff (a, b, c, d, x, s, t) {
|
|
117
|
+
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function md5_gg (a, b, c, d, x, s, t) {
|
|
121
|
+
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function md5_hh (a, b, c, d, x, s, t) {
|
|
125
|
+
return md5_cmn(b ^ c ^ d, a, b, x, s, t)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function md5_ii (a, b, c, d, x, s, t) {
|
|
129
|
+
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/*
|
|
133
|
+
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
134
|
+
* to work around bugs in some JS interpreters.
|
|
135
|
+
*/
|
|
136
|
+
function safe_add (x, y) {
|
|
137
|
+
var lsw = (x & 0xFFFF) + (y & 0xFFFF)
|
|
138
|
+
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
|
|
139
|
+
return (msw << 16) | (lsw & 0xFFFF)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Bitwise rotate a 32-bit number to the left.
|
|
144
|
+
*/
|
|
145
|
+
function bit_rol (num, cnt) {
|
|
146
|
+
return (num << cnt) | (num >>> (32 - cnt))
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = function md5 (buf) {
|
|
150
|
+
return makeHash(buf, core_md5)
|
|
151
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-hash",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "create hashes for browserify",
|
|
5
|
+
"browser": "browser.js",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"standard": "standard",
|
|
9
|
+
"test": "npm run-script standard && npm run-script unit",
|
|
10
|
+
"unit": "node test.js | tspec"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git@github.com:crypto-browserify/createHash.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"crypto"
|
|
18
|
+
],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/crypto-browserify/createHash/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/crypto-browserify/createHash",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"hash-test-vectors": "^1.3.2",
|
|
27
|
+
"standard": "^5.3.1",
|
|
28
|
+
"tap-spec": "^2.1.2",
|
|
29
|
+
"tape": "^3.0.3"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"cipher-base": "^1.0.1",
|
|
33
|
+
"inherits": "^2.0.1",
|
|
34
|
+
"ripemd160": "^2.0.0",
|
|
35
|
+
"sha.js": "^2.4.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
create-hash
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
[](https://travis-ci.org/crypto-browserify/createHash)
|
|
5
|
+
|
|
6
|
+
Node style hashes for use in the browser, with native hash functions in node. Api is the same as hashes in node:
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
var createHash = require('create-hash');
|
|
10
|
+
var hash = createHash('sha224');
|
|
11
|
+
hash.update('synchronous write'); //optional encoding parameter
|
|
12
|
+
hash.digest();// synchronously get result with optional encoding parameter
|
|
13
|
+
|
|
14
|
+
hash.write('write to it as a stream');
|
|
15
|
+
hash.end();//remember it's a stream
|
|
16
|
+
hash.read();//only if you ended it as a stream though
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
To get the JavaScript version even in node do `require('create-hash/browser');`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var test = require('tape')
|
|
2
|
+
|
|
3
|
+
var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160', 'ripemd160']
|
|
4
|
+
var encodings = ['hex', 'base64'] // ignore binary
|
|
5
|
+
var vectors = require('hash-test-vectors')
|
|
6
|
+
vectors.forEach(function (vector) {
|
|
7
|
+
vector.ripemd160 = vector.rmd160
|
|
8
|
+
})
|
|
9
|
+
var createHash = require('./browser')
|
|
10
|
+
|
|
11
|
+
algorithms.forEach(function (algorithm) {
|
|
12
|
+
test('test ' + algorithm + ' against test vectors', function (t) {
|
|
13
|
+
vectors.forEach(function (obj, i) {
|
|
14
|
+
var input = new Buffer(obj.input, 'base64')
|
|
15
|
+
var node = obj[algorithm]
|
|
16
|
+
var js = createHash(algorithm).update(input).digest('hex')
|
|
17
|
+
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
encodings.forEach(function (encoding) {
|
|
21
|
+
vectors.forEach(function (obj, i) {
|
|
22
|
+
var input = new Buffer(obj.input, 'base64').toString(encoding)
|
|
23
|
+
var node = obj[algorithm]
|
|
24
|
+
var js = createHash(algorithm).update(input, encoding).digest('hex')
|
|
25
|
+
t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
vectors.forEach(function (obj, i) {
|
|
30
|
+
var input = new Buffer(obj.input, 'base64')
|
|
31
|
+
var node = obj[algorithm]
|
|
32
|
+
var hash = createHash(algorithm)
|
|
33
|
+
hash.end(input)
|
|
34
|
+
var js = hash.read().toString('hex')
|
|
35
|
+
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
t.end()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# hash-base
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.org/package/hash-base)
|
|
4
|
+
[](https://travis-ci.org/crypto-browserify/hash-base)
|
|
5
|
+
[](https://david-dm.org/crypto-browserify/hash-base#info=dependencies)
|
|
6
|
+
|
|
7
|
+
[](https://github.com/feross/standard)
|
|
8
|
+
|
|
9
|
+
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]).
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
function MyHash () {
|
|
15
|
+
HashBase.call(64) // in bytes
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
inherti(MyHash, HashBase)
|
|
19
|
+
|
|
20
|
+
MyHash.prototype._update = function () {
|
|
21
|
+
// hashing one block with buffer this._block
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
MyHash.prototype._digest = function () {
|
|
25
|
+
// create padding and produce result
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
You also can check [source code](index.js) or [crypto-browserify/md5.js][5]
|
|
29
|
+
|
|
30
|
+
## LICENSE
|
|
31
|
+
|
|
32
|
+
MIT
|
|
33
|
+
|
|
34
|
+
[1]: https://nodejs.org/api/crypto.html#crypto_class_hash
|
|
35
|
+
[2]: https://nodejs.org/api/crypto.html#crypto_class_cipher
|
|
36
|
+
[3]: https://nodejs.org/api/crypto.html#crypto_class_decipher
|
|
37
|
+
[4]: https://github.com/crypto-browserify/cipher-base
|
|
38
|
+
[5]: https://github.com/crypto-browserify/md5.js
|