meteor-node-stubs 1.2.22 → 1.2.23
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/sha.js/.eslintrc +76 -0
- package/node_modules/sha.js/CHANGELOG.md +423 -0
- package/node_modules/sha.js/README.md +1 -1
- package/node_modules/sha.js/bin.js +30 -27
- package/node_modules/sha.js/hash.js +65 -62
- package/node_modules/sha.js/index.js +16 -12
- package/node_modules/sha.js/package.json +56 -28
- package/node_modules/sha.js/sha.js +73 -63
- package/node_modules/sha.js/sha1.js +75 -65
- package/node_modules/sha.js/sha224.js +34 -32
- package/node_modules/sha.js/sha256.js +159 -105
- package/node_modules/sha.js/sha384.js +46 -44
- package/node_modules/sha.js/sha512.js +355 -233
- package/node_modules/sha.js/test/hash.js +63 -58
- package/node_modules/sha.js/test/test.js +120 -82
- package/node_modules/sha.js/test/vectors.js +58 -58
- package/package.json +3 -1
- package/node_modules/sha.js/.travis.yml +0 -17
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
|
|
3
5
|
* in FIPS 180-2
|
|
@@ -6,48 +8,48 @@
|
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
|
-
var inherits = require('inherits')
|
|
10
|
-
var Sha256 = require('./sha256')
|
|
11
|
-
var Hash = require('./hash')
|
|
12
|
-
var Buffer = require('safe-buffer').Buffer
|
|
11
|
+
var inherits = require('inherits');
|
|
12
|
+
var Sha256 = require('./sha256');
|
|
13
|
+
var Hash = require('./hash');
|
|
14
|
+
var Buffer = require('safe-buffer').Buffer;
|
|
13
15
|
|
|
14
|
-
var W = new Array(64)
|
|
16
|
+
var W = new Array(64);
|
|
15
17
|
|
|
16
|
-
function Sha224
|
|
17
|
-
|
|
18
|
+
function Sha224() {
|
|
19
|
+
this.init();
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
this._w = W; // new Array(64)
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Hash.call(this, 64, 56);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
inherits(Sha224, Sha256)
|
|
26
|
+
inherits(Sha224, Sha256);
|
|
25
27
|
|
|
26
28
|
Sha224.prototype.init = function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
29
|
+
this._a = 0xc1059ed8;
|
|
30
|
+
this._b = 0x367cd507;
|
|
31
|
+
this._c = 0x3070dd17;
|
|
32
|
+
this._d = 0xf70e5939;
|
|
33
|
+
this._e = 0xffc00b31;
|
|
34
|
+
this._f = 0x68581511;
|
|
35
|
+
this._g = 0x64f98fa7;
|
|
36
|
+
this._h = 0xbefa4fa4;
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
};
|
|
38
40
|
|
|
39
41
|
Sha224.prototype._hash = function () {
|
|
40
|
-
|
|
42
|
+
var H = Buffer.allocUnsafe(28);
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
H.writeInt32BE(this._a, 0);
|
|
45
|
+
H.writeInt32BE(this._b, 4);
|
|
46
|
+
H.writeInt32BE(this._c, 8);
|
|
47
|
+
H.writeInt32BE(this._d, 12);
|
|
48
|
+
H.writeInt32BE(this._e, 16);
|
|
49
|
+
H.writeInt32BE(this._f, 20);
|
|
50
|
+
H.writeInt32BE(this._g, 24);
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
+
return H;
|
|
53
|
+
};
|
|
52
54
|
|
|
53
|
-
module.exports = Sha224
|
|
55
|
+
module.exports = Sha224;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
|
|
3
5
|
* in FIPS 180-2
|
|
@@ -6,130 +8,182 @@
|
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
|
-
var inherits = require('inherits')
|
|
10
|
-
var Hash = require('./hash')
|
|
11
|
-
var Buffer = require('safe-buffer').Buffer
|
|
11
|
+
var inherits = require('inherits');
|
|
12
|
+
var Hash = require('./hash');
|
|
13
|
+
var Buffer = require('safe-buffer').Buffer;
|
|
12
14
|
|
|
13
15
|
var K = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
0x428A2F98,
|
|
17
|
+
0x71374491,
|
|
18
|
+
0xB5C0FBCF,
|
|
19
|
+
0xE9B5DBA5,
|
|
20
|
+
0x3956C25B,
|
|
21
|
+
0x59F111F1,
|
|
22
|
+
0x923F82A4,
|
|
23
|
+
0xAB1C5ED5,
|
|
24
|
+
0xD807AA98,
|
|
25
|
+
0x12835B01,
|
|
26
|
+
0x243185BE,
|
|
27
|
+
0x550C7DC3,
|
|
28
|
+
0x72BE5D74,
|
|
29
|
+
0x80DEB1FE,
|
|
30
|
+
0x9BDC06A7,
|
|
31
|
+
0xC19BF174,
|
|
32
|
+
0xE49B69C1,
|
|
33
|
+
0xEFBE4786,
|
|
34
|
+
0x0FC19DC6,
|
|
35
|
+
0x240CA1CC,
|
|
36
|
+
0x2DE92C6F,
|
|
37
|
+
0x4A7484AA,
|
|
38
|
+
0x5CB0A9DC,
|
|
39
|
+
0x76F988DA,
|
|
40
|
+
0x983E5152,
|
|
41
|
+
0xA831C66D,
|
|
42
|
+
0xB00327C8,
|
|
43
|
+
0xBF597FC7,
|
|
44
|
+
0xC6E00BF3,
|
|
45
|
+
0xD5A79147,
|
|
46
|
+
0x06CA6351,
|
|
47
|
+
0x14292967,
|
|
48
|
+
0x27B70A85,
|
|
49
|
+
0x2E1B2138,
|
|
50
|
+
0x4D2C6DFC,
|
|
51
|
+
0x53380D13,
|
|
52
|
+
0x650A7354,
|
|
53
|
+
0x766A0ABB,
|
|
54
|
+
0x81C2C92E,
|
|
55
|
+
0x92722C85,
|
|
56
|
+
0xA2BFE8A1,
|
|
57
|
+
0xA81A664B,
|
|
58
|
+
0xC24B8B70,
|
|
59
|
+
0xC76C51A3,
|
|
60
|
+
0xD192E819,
|
|
61
|
+
0xD6990624,
|
|
62
|
+
0xF40E3585,
|
|
63
|
+
0x106AA070,
|
|
64
|
+
0x19A4C116,
|
|
65
|
+
0x1E376C08,
|
|
66
|
+
0x2748774C,
|
|
67
|
+
0x34B0BCB5,
|
|
68
|
+
0x391C0CB3,
|
|
69
|
+
0x4ED8AA4A,
|
|
70
|
+
0x5B9CCA4F,
|
|
71
|
+
0x682E6FF3,
|
|
72
|
+
0x748F82EE,
|
|
73
|
+
0x78A5636F,
|
|
74
|
+
0x84C87814,
|
|
75
|
+
0x8CC70208,
|
|
76
|
+
0x90BEFFFA,
|
|
77
|
+
0xA4506CEB,
|
|
78
|
+
0xBEF9A3F7,
|
|
79
|
+
0xC67178F2
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
var W = new Array(64);
|
|
83
|
+
|
|
84
|
+
function Sha256() {
|
|
85
|
+
this.init();
|
|
86
|
+
|
|
87
|
+
this._w = W; // new Array(64)
|
|
88
|
+
|
|
89
|
+
Hash.call(this, 64, 56);
|
|
40
90
|
}
|
|
41
91
|
|
|
42
|
-
inherits(Sha256, Hash)
|
|
92
|
+
inherits(Sha256, Hash);
|
|
43
93
|
|
|
44
94
|
Sha256.prototype.init = function () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function ch
|
|
58
|
-
|
|
95
|
+
this._a = 0x6a09e667;
|
|
96
|
+
this._b = 0xbb67ae85;
|
|
97
|
+
this._c = 0x3c6ef372;
|
|
98
|
+
this._d = 0xa54ff53a;
|
|
99
|
+
this._e = 0x510e527f;
|
|
100
|
+
this._f = 0x9b05688c;
|
|
101
|
+
this._g = 0x1f83d9ab;
|
|
102
|
+
this._h = 0x5be0cd19;
|
|
103
|
+
|
|
104
|
+
return this;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function ch(x, y, z) {
|
|
108
|
+
return z ^ (x & (y ^ z));
|
|
59
109
|
}
|
|
60
110
|
|
|
61
|
-
function maj
|
|
62
|
-
|
|
111
|
+
function maj(x, y, z) {
|
|
112
|
+
return (x & y) | (z & (x | y));
|
|
63
113
|
}
|
|
64
114
|
|
|
65
|
-
function sigma0
|
|
66
|
-
|
|
115
|
+
function sigma0(x) {
|
|
116
|
+
return ((x >>> 2) | (x << 30)) ^ ((x >>> 13) | (x << 19)) ^ ((x >>> 22) | (x << 10));
|
|
67
117
|
}
|
|
68
118
|
|
|
69
|
-
function sigma1
|
|
70
|
-
|
|
119
|
+
function sigma1(x) {
|
|
120
|
+
return ((x >>> 6) | (x << 26)) ^ ((x >>> 11) | (x << 21)) ^ ((x >>> 25) | (x << 7));
|
|
71
121
|
}
|
|
72
122
|
|
|
73
|
-
function gamma0
|
|
74
|
-
|
|
123
|
+
function gamma0(x) {
|
|
124
|
+
return ((x >>> 7) | (x << 25)) ^ ((x >>> 18) | (x << 14)) ^ (x >>> 3);
|
|
75
125
|
}
|
|
76
126
|
|
|
77
|
-
function gamma1
|
|
78
|
-
|
|
127
|
+
function gamma1(x) {
|
|
128
|
+
return ((x >>> 17) | (x << 15)) ^ ((x >>> 19) | (x << 13)) ^ (x >>> 10);
|
|
79
129
|
}
|
|
80
130
|
|
|
81
131
|
Sha256.prototype._update = function (M) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
var w = this._w;
|
|
133
|
+
|
|
134
|
+
var a = this._a | 0;
|
|
135
|
+
var b = this._b | 0;
|
|
136
|
+
var c = this._c | 0;
|
|
137
|
+
var d = this._d | 0;
|
|
138
|
+
var e = this._e | 0;
|
|
139
|
+
var f = this._f | 0;
|
|
140
|
+
var g = this._g | 0;
|
|
141
|
+
var h = this._h | 0;
|
|
142
|
+
|
|
143
|
+
for (var i = 0; i < 16; ++i) {
|
|
144
|
+
w[i] = M.readInt32BE(i * 4);
|
|
145
|
+
}
|
|
146
|
+
for (; i < 64; ++i) {
|
|
147
|
+
w[i] = (gamma1(w[i - 2]) + w[i - 7] + gamma0(w[i - 15]) + w[i - 16]) | 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (var j = 0; j < 64; ++j) {
|
|
151
|
+
var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + w[j]) | 0;
|
|
152
|
+
var T2 = (sigma0(a) + maj(a, b, c)) | 0;
|
|
153
|
+
|
|
154
|
+
h = g;
|
|
155
|
+
g = f;
|
|
156
|
+
f = e;
|
|
157
|
+
e = (d + T1) | 0;
|
|
158
|
+
d = c;
|
|
159
|
+
c = b;
|
|
160
|
+
b = a;
|
|
161
|
+
a = (T1 + T2) | 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
this._a = (a + this._a) | 0;
|
|
165
|
+
this._b = (b + this._b) | 0;
|
|
166
|
+
this._c = (c + this._c) | 0;
|
|
167
|
+
this._d = (d + this._d) | 0;
|
|
168
|
+
this._e = (e + this._e) | 0;
|
|
169
|
+
this._f = (f + this._f) | 0;
|
|
170
|
+
this._g = (g + this._g) | 0;
|
|
171
|
+
this._h = (h + this._h) | 0;
|
|
172
|
+
};
|
|
119
173
|
|
|
120
174
|
Sha256.prototype._hash = function () {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
175
|
+
var H = Buffer.allocUnsafe(32);
|
|
176
|
+
|
|
177
|
+
H.writeInt32BE(this._a, 0);
|
|
178
|
+
H.writeInt32BE(this._b, 4);
|
|
179
|
+
H.writeInt32BE(this._c, 8);
|
|
180
|
+
H.writeInt32BE(this._d, 12);
|
|
181
|
+
H.writeInt32BE(this._e, 16);
|
|
182
|
+
H.writeInt32BE(this._f, 20);
|
|
183
|
+
H.writeInt32BE(this._g, 24);
|
|
184
|
+
H.writeInt32BE(this._h, 28);
|
|
185
|
+
|
|
186
|
+
return H;
|
|
187
|
+
};
|
|
134
188
|
|
|
135
|
-
module.exports = Sha256
|
|
189
|
+
module.exports = Sha256;
|
|
@@ -1,57 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
var SHA512 = require('./sha512')
|
|
3
|
-
var Hash = require('./hash')
|
|
4
|
-
var Buffer = require('safe-buffer').Buffer
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
var
|
|
3
|
+
var inherits = require('inherits');
|
|
4
|
+
var SHA512 = require('./sha512');
|
|
5
|
+
var Hash = require('./hash');
|
|
6
|
+
var Buffer = require('safe-buffer').Buffer;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
this.init()
|
|
10
|
-
this._w = W
|
|
8
|
+
var W = new Array(160);
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
function Sha384() {
|
|
11
|
+
this.init();
|
|
12
|
+
this._w = W;
|
|
13
|
+
|
|
14
|
+
Hash.call(this, 128, 112);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
inherits(Sha384, SHA512)
|
|
17
|
+
inherits(Sha384, SHA512);
|
|
16
18
|
|
|
17
19
|
Sha384.prototype.init = function () {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
20
|
+
this._ah = 0xcbbb9d5d;
|
|
21
|
+
this._bh = 0x629a292a;
|
|
22
|
+
this._ch = 0x9159015a;
|
|
23
|
+
this._dh = 0x152fecd8;
|
|
24
|
+
this._eh = 0x67332667;
|
|
25
|
+
this._fh = 0x8eb44a87;
|
|
26
|
+
this._gh = 0xdb0c2e0d;
|
|
27
|
+
this._hh = 0x47b5481d;
|
|
28
|
+
|
|
29
|
+
this._al = 0xc1059ed8;
|
|
30
|
+
this._bl = 0x367cd507;
|
|
31
|
+
this._cl = 0x3070dd17;
|
|
32
|
+
this._dl = 0xf70e5939;
|
|
33
|
+
this._el = 0xffc00b31;
|
|
34
|
+
this._fl = 0x68581511;
|
|
35
|
+
this._gl = 0x64f98fa7;
|
|
36
|
+
this._hl = 0xbefa4fa4;
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
};
|
|
38
40
|
|
|
39
41
|
Sha384.prototype._hash = function () {
|
|
40
|
-
|
|
42
|
+
var H = Buffer.allocUnsafe(48);
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
function writeInt64BE(h, l, offset) {
|
|
45
|
+
H.writeInt32BE(h, offset);
|
|
46
|
+
H.writeInt32BE(l, offset + 4);
|
|
47
|
+
}
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
writeInt64BE(this._ah, this._al, 0);
|
|
50
|
+
writeInt64BE(this._bh, this._bl, 8);
|
|
51
|
+
writeInt64BE(this._ch, this._cl, 16);
|
|
52
|
+
writeInt64BE(this._dh, this._dl, 24);
|
|
53
|
+
writeInt64BE(this._eh, this._el, 32);
|
|
54
|
+
writeInt64BE(this._fh, this._fl, 40);
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
+
return H;
|
|
57
|
+
};
|
|
56
58
|
|
|
57
|
-
module.exports = Sha384
|
|
59
|
+
module.exports = Sha384;
|