js-sha3 0.5.7 → 0.8.0
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/CHANGELOG.md +106 -74
- package/LICENSE.txt +1 -1
- package/README.md +52 -36
- package/build/sha3.min.js +8 -8
- package/index.d.ts +225 -0
- package/package.json +45 -39
- package/src/sha3.js +656 -475
- package/.covignore +0 -2
- package/.npmignore +0 -3
- package/.travis.yml +0 -12
- package/bower.json +0 -9
- package/tests/index.html +0 -23
- package/tests/node-test.js +0 -60
- package/tests/test-shake.js +0 -106
- package/tests/test.js +0 -316
package/CHANGELOG.md
CHANGED
|
@@ -1,74 +1,106 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
## v0.
|
|
4
|
-
###
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
###
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
###
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
###
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
## v0.
|
|
65
|
-
###
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
## v0.
|
|
69
|
-
###
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## v0.8.0 / 2018-08-05
|
|
4
|
+
### Added
|
|
5
|
+
- TypeScript definitions.
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- throw error if update after finalize
|
|
9
|
+
|
|
10
|
+
## v0.7.0 / 2017-12-01
|
|
11
|
+
### Added
|
|
12
|
+
- AMD support.
|
|
13
|
+
- support for web worker. #13
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- throw error if input type is incorrect when cSHAKE and KMAC.
|
|
17
|
+
- freeze hash after finalize.
|
|
18
|
+
|
|
19
|
+
## v0.6.1 / 2017-07-03
|
|
20
|
+
### Fixed
|
|
21
|
+
- Typo on variable kmac_256 type definition. #12
|
|
22
|
+
|
|
23
|
+
## v0.6.0 / 2017-06-15
|
|
24
|
+
### Added
|
|
25
|
+
- cSHAKE method.
|
|
26
|
+
- KMAC method.
|
|
27
|
+
- alias methods without underscore like shake128, keccak512.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- throw error if input type is incorrect.
|
|
31
|
+
|
|
32
|
+
## v0.5.7 / 2016-12-30
|
|
33
|
+
### Fixed
|
|
34
|
+
- ArrayBuffer detection in old browsers.
|
|
35
|
+
|
|
36
|
+
## v0.5.6 / 2016-12-29
|
|
37
|
+
### Fixed
|
|
38
|
+
- ArrayBuffer dosen't work in Webpack.
|
|
39
|
+
|
|
40
|
+
## v0.5.5 / 2016-09-26
|
|
41
|
+
### Added
|
|
42
|
+
- TypeScript support.
|
|
43
|
+
- ArrayBuffer method.
|
|
44
|
+
|
|
45
|
+
### Deprecated
|
|
46
|
+
- Buffer method.
|
|
47
|
+
|
|
48
|
+
## v0.5.4 / 2016-09-12
|
|
49
|
+
### Fixed
|
|
50
|
+
- CommonJS detection.
|
|
51
|
+
|
|
52
|
+
## v0.5.3 / 2016-09-08
|
|
53
|
+
### Added
|
|
54
|
+
- Some missing files to npm package.
|
|
55
|
+
|
|
56
|
+
## v0.5.2 / 2016-06-06
|
|
57
|
+
### Fixed
|
|
58
|
+
- Shake output incorrect in the special length.
|
|
59
|
+
|
|
60
|
+
## v0.5.1 / 2015-10-27
|
|
61
|
+
### Fixed
|
|
62
|
+
- Version in package.json and bower.json.
|
|
63
|
+
|
|
64
|
+
## v0.5.0 / 2015-09-23
|
|
65
|
+
### Added
|
|
66
|
+
- Hash object with create/update interface.
|
|
67
|
+
|
|
68
|
+
## v0.4.1 / 2015-09-18
|
|
69
|
+
### Added
|
|
70
|
+
- Integer array output.
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
- Shake output incorrect when it's greater than 1088.
|
|
74
|
+
|
|
75
|
+
## v0.4.0 / 2015-09-17
|
|
76
|
+
### Added
|
|
77
|
+
- ArrayBuffer output.
|
|
78
|
+
- Shake alogirthms.
|
|
79
|
+
|
|
80
|
+
## v0.3.1 / 2015-05-22
|
|
81
|
+
### Fixed
|
|
82
|
+
- Some bugs.
|
|
83
|
+
|
|
84
|
+
## v0.3.0 / 2015-05-21
|
|
85
|
+
### Added
|
|
86
|
+
- Integer array input.
|
|
87
|
+
- ArrayBuffer input.
|
|
88
|
+
|
|
89
|
+
## v0.2.0 / 2015-04-04
|
|
90
|
+
### Added
|
|
91
|
+
- NIST's May 2014 SHA-3 version.
|
|
92
|
+
|
|
93
|
+
### Changed
|
|
94
|
+
- Rename original methods to keccak.
|
|
95
|
+
|
|
96
|
+
## v0.1.2 / 2015-02-27
|
|
97
|
+
### Changed
|
|
98
|
+
- Improve performance.
|
|
99
|
+
|
|
100
|
+
## v0.1.1 / 2015-02-26
|
|
101
|
+
### Changed
|
|
102
|
+
- Improve performance.
|
|
103
|
+
|
|
104
|
+
## v0.1.0 / 2015-02-23
|
|
105
|
+
### Added
|
|
106
|
+
- First version implementation.
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 encoding.
|
|
8
8
|
|
|
9
9
|
## Notice
|
|
10
|
+
* v0.8.0+ will throw an error if try to update hash after finalize.
|
|
10
11
|
* Sha3 methods has been renamed to keccak since v0.2.0. It means that sha3 methods of v0.1.x are equal to keccak methods of v0.2.x and later.
|
|
11
12
|
* `buffer` method is deprecated. This maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.
|
|
12
13
|
|
|
@@ -19,8 +20,8 @@ A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 enco
|
|
|
19
20
|
[Keccak-384 Online](http://emn178.github.io/online-tools/keccak_384.html)
|
|
20
21
|
[Keccak-256 Online](http://emn178.github.io/online-tools/keccak_256.html)
|
|
21
22
|
[Keccak-224 Online](http://emn178.github.io/online-tools/keccak_224.html)
|
|
22
|
-
[
|
|
23
|
-
[
|
|
23
|
+
[Shake128 Online](http://emn178.github.io/online-tools/shake_128.html)
|
|
24
|
+
[Shake256 Online](http://emn178.github.io/online-tools/shake_256.html)
|
|
24
25
|
|
|
25
26
|
## Download
|
|
26
27
|
[Compress](https://raw.github.com/emn178/js-sha3/master/build/sha3.min.js)
|
|
@@ -42,23 +43,28 @@ sha3_512('Message to hash');
|
|
|
42
43
|
sha3_384('Message to hash');
|
|
43
44
|
sha3_256('Message to hash');
|
|
44
45
|
sha3_224('Message to hash');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
keccak512('Message to hash');
|
|
47
|
+
keccak384('Message to hash');
|
|
48
|
+
keccak256('Message to hash');
|
|
49
|
+
keccak224('Message to hash');
|
|
50
|
+
shake128('Message to hash', 256);
|
|
51
|
+
shake256('Message to hash', 512);
|
|
52
|
+
cshake128('Message to hash', 256, 'function name', 'customization');
|
|
53
|
+
cshake256('Message to hash', 512, 'function name', 'customization');
|
|
54
|
+
kmac128('key', 'Message to hash', 256, 'customization');
|
|
55
|
+
kmac256('key', 'Message to hash', 512, 'customization');
|
|
51
56
|
|
|
52
57
|
// Support ArrayBuffer output
|
|
53
|
-
var
|
|
58
|
+
var arrayBuffer = keccak224.arrayBuffer('Message to hash');
|
|
54
59
|
|
|
55
60
|
// Support Array output
|
|
56
|
-
var
|
|
61
|
+
var bytes = keccak224.digest('Message to hash');
|
|
62
|
+
var bytes = keccak224.array('Message to hash');
|
|
57
63
|
|
|
58
64
|
// update hash
|
|
59
65
|
sha3_512.update('Message ').update('to ').update('hash').hex();
|
|
60
66
|
// specify shake output bits at first update
|
|
61
|
-
|
|
67
|
+
shake128.update('Message ', 256).update('to ').update('hash').hex();
|
|
62
68
|
|
|
63
69
|
// or to use create
|
|
64
70
|
var hash = sha3_512.create();
|
|
@@ -67,10 +73,16 @@ hash.update('...');
|
|
|
67
73
|
hash.hex();
|
|
68
74
|
|
|
69
75
|
// specify shake output bits when creating
|
|
70
|
-
var hash =
|
|
76
|
+
var hash = shake128.create(256);
|
|
71
77
|
hash.update('...');
|
|
72
78
|
hash.update('...');
|
|
73
79
|
hash.hex();
|
|
80
|
+
|
|
81
|
+
// specify cshake output bits, function name and customization when creating
|
|
82
|
+
var hash = cshake128.create(256, 'function name', 'customization');
|
|
83
|
+
|
|
84
|
+
// specify kmac key, output bits and customization when creating
|
|
85
|
+
var hash = kmac128.create('key', 256, 'customization');
|
|
74
86
|
```
|
|
75
87
|
If you use node.js, you should require the module first:
|
|
76
88
|
```JavaScript
|
|
@@ -78,12 +90,16 @@ sha3_512 = require('js-sha3').sha3_512;
|
|
|
78
90
|
sha3_384 = require('js-sha3').sha3_384;
|
|
79
91
|
sha3_256 = require('js-sha3').sha3_256;
|
|
80
92
|
sha3_224 = require('js-sha3').sha3_224;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
keccak512 = require('js-sha3').keccak512;
|
|
94
|
+
keccak384 = require('js-sha3').keccak384;
|
|
95
|
+
keccak256 = require('js-sha3').keccak256;
|
|
96
|
+
keccak224 = require('js-sha3').keccak224;
|
|
97
|
+
shake128 = require('js-sha3').shake128;
|
|
98
|
+
shake256 = require('js-sha3').shake256;
|
|
99
|
+
cshake128 = require('js-sha3').cshake128;
|
|
100
|
+
cshake256 = require('js-sha3').cshake256;
|
|
101
|
+
kmac128 = require('js-sha3').kmac128;
|
|
102
|
+
kmac256 = require('js-sha3').kmac256;
|
|
87
103
|
```
|
|
88
104
|
If you use TypeScript, you can import like this:
|
|
89
105
|
```TypeScript
|
|
@@ -129,46 +145,46 @@ sha3_224('The quick brown fox jumps over the lazy dog');
|
|
|
129
145
|
sha3_224('The quick brown fox jumps over the lazy dog.');
|
|
130
146
|
// 2d0708903833afabdd232a20201176e8b58c5be8a6fe74265ac54db0
|
|
131
147
|
|
|
132
|
-
|
|
148
|
+
keccak512('');
|
|
133
149
|
// 0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e
|
|
134
150
|
|
|
135
|
-
|
|
151
|
+
keccak512('The quick brown fox jumps over the lazy dog');
|
|
136
152
|
// d135bb84d0439dbac432247ee573a23ea7d3c9deb2a968eb31d47c4fb45f1ef4422d6c531b5b9bd6f449ebcc449ea94d0a8f05f62130fda612da53c79659f609
|
|
137
153
|
|
|
138
|
-
|
|
154
|
+
keccak512('The quick brown fox jumps over the lazy dog.');
|
|
139
155
|
// ab7192d2b11f51c7dd744e7b3441febf397ca07bf812cceae122ca4ded6387889064f8db9230f173f6d1ab6e24b6e50f065b039f799f5592360a6558eb52d760
|
|
140
156
|
|
|
141
|
-
|
|
157
|
+
keccak384('');
|
|
142
158
|
// 2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff
|
|
143
159
|
|
|
144
|
-
|
|
160
|
+
keccak384('The quick brown fox jumps over the lazy dog');
|
|
145
161
|
// 283990fa9d5fb731d786c5bbee94ea4db4910f18c62c03d173fc0a5e494422e8a0b3da7574dae7fa0baf005e504063b3
|
|
146
162
|
|
|
147
|
-
|
|
163
|
+
keccak384('The quick brown fox jumps over the lazy dog.');
|
|
148
164
|
// 9ad8e17325408eddb6edee6147f13856ad819bb7532668b605a24a2d958f88bd5c169e56dc4b2f89ffd325f6006d820b
|
|
149
165
|
|
|
150
|
-
|
|
166
|
+
keccak256('');
|
|
151
167
|
// c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
|
|
152
168
|
|
|
153
|
-
|
|
169
|
+
keccak256('The quick brown fox jumps over the lazy dog');
|
|
154
170
|
// 4d741b6f1eb29cb2a9b9911c82f56fa8d73b04959d3d9d222895df6c0b28aa15
|
|
155
171
|
|
|
156
|
-
|
|
172
|
+
keccak256('The quick brown fox jumps over the lazy dog.');
|
|
157
173
|
// 578951e24efd62a3d63a86f7cd19aaa53c898fe287d2552133220370240b572d
|
|
158
174
|
|
|
159
|
-
|
|
175
|
+
keccak224('');
|
|
160
176
|
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
|
|
161
177
|
|
|
162
|
-
|
|
178
|
+
keccak224('The quick brown fox jumps over the lazy dog');
|
|
163
179
|
// 310aee6b30c47350576ac2873fa89fd190cdc488442f3ef654cf23fe
|
|
164
180
|
|
|
165
|
-
|
|
181
|
+
keccak224('The quick brown fox jumps over the lazy dog.');
|
|
166
182
|
// c59d4eaeac728671c635ff645014e2afa935bebffdb5fbd207ffdeab
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
shake128('', 256);
|
|
169
185
|
// 7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26
|
|
170
186
|
|
|
171
|
-
|
|
187
|
+
shake256('', 512);
|
|
172
188
|
// 46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be
|
|
173
189
|
```
|
|
174
190
|
It also supports UTF-8 encoding:
|
|
@@ -187,16 +203,16 @@ sha3_256('中文');
|
|
|
187
203
|
sha3_224('中文');
|
|
188
204
|
// 106d169e10b61c2a2a05554d3e631ec94467f8316640f29545d163ee
|
|
189
205
|
|
|
190
|
-
|
|
206
|
+
keccak512('中文');
|
|
191
207
|
// 2f6a1bd50562230229af34b0ccf46b8754b89d23ae2c5bf7840b4acfcef86f87395edc0a00b2bfef53bafebe3b79de2e3e01cbd8169ddbb08bde888dcc893524
|
|
192
208
|
|
|
193
|
-
|
|
209
|
+
keccak384('中文');
|
|
194
210
|
// 743f64bb7544c6ed923be4741b738dde18b7cee384a3a09c4e01acaaac9f19222cdee137702bd3aa05dc198373d87d6c
|
|
195
211
|
|
|
196
|
-
|
|
212
|
+
keccak256('中文');
|
|
197
213
|
// 70a2b6579047f0a977fcb5e9120a4e07067bea9abb6916fbc2d13ffb9a4e4eee
|
|
198
214
|
|
|
199
|
-
|
|
215
|
+
keccak224('中文');
|
|
200
216
|
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
|
|
201
217
|
```
|
|
202
218
|
|
package/build/sha3.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
|
-
*
|
|
4
|
-
* @version 0.
|
|
5
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
-
* @copyright Chen, Yi-Cyuan 2015-
|
|
7
|
-
* @license MIT
|
|
1
|
+
/**
|
|
2
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
|
+
*
|
|
4
|
+
* @version 0.8.0
|
|
5
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
7
|
+
* @license MIT
|
|
8
8
|
*/
|
|
9
|
-
!function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var
|
|
9
|
+
!function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n){t.call(this,e,r,n)}var r="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=global:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),c=[4,1024,262144,67108864],h=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],l=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var A=function(e,r,n){return function(i){return new t(e,r,e).update(i)[n]()}},w=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},v=function(t,e,r){return function(e,n,i,o){return S["cshake"+t].update(e,n,i,o)[r]()}},B=function(t,e,r){return function(e,n,i,o){return S["kmac"+t].update(e,n,i,o)[r]()}},g=function(t,e,r,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=e(r,n,o)}return t},_=function(e,r){var n=A(e,r,"hex");return n.create=function(){return new t(e,r,e)},n.update=function(t){return n.create().update(t)},g(n,A,e,r)},k=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:l,createMethod:function(e,r){var n=w(e,r,"hex");return n.create=function(n){return new t(e,r,n)},n.update=function(t,e){return n.create(e).update(t)},g(n,w,e,r)}},{name:"cshake",padding:c,bits:l,createMethod:function(e,r){var n=b[e],i=v(e,0,"hex");return i.create=function(i,o,a){return o||a?new t(e,r,i).bytepad([o,a],n):S["shake"+e].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},g(i,v,e,r)}},{name:"kmac",padding:c,bits:l,createMethod:function(t,r){var n=b[t],i=B(t,0,"hex");return i.create=function(i,o,a){return new e(t,r,o).bytepad(["KMAC",a],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},g(i,B,t,r)}}],S={},C=[],x=0;x<k.length;++x)for(var m=k[x],E=m.bits,O=0;O<E.length;++O){var z=m.name+"_"+E[O];if(C.push(z),S[z]=m.createMethod(E[O],m.padding),"sha3"!==m.name){var N=m.name+E[O];C.push(N),S[N]=S[z]}}t.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}for(var i,o,a=this.blocks,s=this.byteCount,f=t.length,c=this.blockCount,p=0,d=this.s;p<f;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<c+1;++i)a[i]=0;if(e)for(i=this.start;p<f&&i<s;++p)a[i>>2]|=t[p]<<h[3&i++];else for(i=this.start;p<f&&i<s;++p)(o=t.charCodeAt(p))<128?a[i>>2]|=o<<h[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<h[3&i++],a[i>>2]|=(128|o>>6&63)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++p)),a[i>>2]|=(240|o>>18)<<h[3&i++],a[i>>2]|=(128|o>>12&63)<<h[3&i++],a[i>>2]|=(128|o>>6&63)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]);if(this.lastByteIndex=i,i>=s){for(this.start=i-s,this.block=a[c],i=0;i<c;++i)d[i]^=a[i];j(d),this.reset=!0}else this.start=i}return this},t.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},t.prototype.encodeString=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a<t.length;++a){var s=t.charCodeAt(a);s<128?i+=1:s<2048?i+=2:s<55296||s>=57344?i+=3:(s=65536+((1023&s)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},t.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];j(n)}},t.prototype.toString=t.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<n;){for(o=0;o<e&&a<n;++o,++a)t=r[o],s+=f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];a%e==0&&(j(r),o=0)}return i&&(t=r[o],s+=f[t>>4&15]+f[15&t],i>1&&(s+=f[t>>12&15]+f[t>>8&15]),i>2&&(s+=f[t>>20&15]+f[t>>16&15])),s},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<n;){for(o=0;o<e&&a<n;++o,++a)u[a]=r[o];a%e==0&&j(r)}return i&&(u[o]=r[o],t=t.slice(0,s)),t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.digest=t.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=s<<2,e=n[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&j(n)}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},(e.prototype=new t).finalize=function(){return this.encode(this.outputBits,!0),t.prototype.finalize.call(this)};var j=function(t){var e,r,n,i,o,a,s,u,f,c,h,d,l,y,b,A,w,v,B,g,_,k,S,C,x,m,E,O,z,N,j,J,M,H,I,R,U,V,F,D,W,Y,K,q,G,L,P,Q,T,X,Z,$,tt,et,rt,nt,it,ot,at,st,ut,ft,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(c<<1|h>>>31),r=s^(h<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],b=t[1],L=t[11]<<4|t[10]>>>28,P=t[10]<<4|t[11]>>>28,O=t[20]<<3|t[21]>>>29,z=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,H=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,A=t[13]<<12|t[12]>>>20,w=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,N=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,R=t[14]<<6|t[15]>>>26,U=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,B=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,J=t[45]<<29|t[44]>>>3,M=t[44]<<29|t[45]>>>3,C=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,V=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,g=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,m=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,D=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,k=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=y^~A&v,t[1]=b^~w&B,t[10]=C^~m&O,t[11]=x^~E&z,t[20]=H^~R&V,t[21]=I^~U&F,t[30]=q^~L&Q,t[31]=G^~P&T,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=A^~v&g,t[3]=w^~B&_,t[12]=m^~O&N,t[13]=E^~z&j,t[22]=R^~V&D,t[23]=U^~F&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=v^~g&k,t[5]=B^~_&S,t[14]=O^~N&J,t[15]=z^~j&M,t[24]=V^~D&Y,t[25]=F^~W&K,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ct,t[6]=g^~k&y,t[7]=_^~S&b,t[16]=N^~J&C,t[17]=j^~M&x,t[26]=D^~Y&H,t[27]=W^~K&I,t[36]=X^~$&q,t[37]=Z^~tt&G,t[46]=st^~ft&et,t[47]=ut^~ct&rt,t[8]=k^~y&A,t[9]=S^~b&w,t[18]=J^~C&m,t[19]=M^~x&E,t[28]=Y^~H&R,t[29]=K^~I&U,t[38]=$^~q&L,t[39]=tt^~G&P,t[48]=ft^~et&nt,t[49]=ct^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(a)module.exports=S;else{for(x=0;x<C.length;++x)i[C[x]]=S[C[x]];s&&define(function(){return S})}}();
|