js-sha3 0.5.6 → 0.7.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 +99 -70
- package/LICENSE.txt +1 -1
- package/README.md +50 -36
- package/build/sha3.min.js +9 -22
- package/index.d.ts +76 -0
- package/package.json +45 -35
- package/src/sha3.js +655 -475
- package/.covignore +0 -2
- package/.npmignore +0 -2
- package/.travis.yml +0 -12
- package/bower.json +0 -9
- package/tests/index.html +0 -23
- package/tests/node-test.js +0 -59
- package/tests/test-shake.js +0 -106
- package/tests/test.js +0 -316
package/CHANGELOG.md
CHANGED
|
@@ -1,70 +1,99 @@
|
|
|
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
|
-
## v0.3
|
|
46
|
-
###
|
|
47
|
-
- Some
|
|
48
|
-
|
|
49
|
-
## v0.
|
|
50
|
-
###
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
###
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
## v0.
|
|
69
|
-
### Added
|
|
70
|
-
-
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## v0.7.0 / 2017-12-01
|
|
4
|
+
### Added
|
|
5
|
+
- AMD support.
|
|
6
|
+
- support for web worker. #13
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- throw error if input type is incorrect when cSHAKE and KMAC.
|
|
10
|
+
- freeze hash after finalize.
|
|
11
|
+
|
|
12
|
+
## v0.6.1 / 2017-07-03
|
|
13
|
+
### Fixed
|
|
14
|
+
- Typo on variable kmac_256 type definition. #12
|
|
15
|
+
|
|
16
|
+
## v0.6.0 / 2017-06-15
|
|
17
|
+
### Added
|
|
18
|
+
- cSHAKE method.
|
|
19
|
+
- KMAC method.
|
|
20
|
+
- alias methods without underscore like shake128, keccak512.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- throw error if input type is incorrect.
|
|
24
|
+
|
|
25
|
+
## v0.5.7 / 2016-12-30
|
|
26
|
+
### Fixed
|
|
27
|
+
- ArrayBuffer detection in old browsers.
|
|
28
|
+
|
|
29
|
+
## v0.5.6 / 2016-12-29
|
|
30
|
+
### Fixed
|
|
31
|
+
- ArrayBuffer dosen't work in Webpack.
|
|
32
|
+
|
|
33
|
+
## v0.5.5 / 2016-09-26
|
|
34
|
+
### Added
|
|
35
|
+
- TypeScript support.
|
|
36
|
+
- ArrayBuffer method.
|
|
37
|
+
|
|
38
|
+
### Deprecated
|
|
39
|
+
- Buffer method.
|
|
40
|
+
|
|
41
|
+
## v0.5.4 / 2016-09-12
|
|
42
|
+
### Fixed
|
|
43
|
+
- CommonJS detection.
|
|
44
|
+
|
|
45
|
+
## v0.5.3 / 2016-09-08
|
|
46
|
+
### Added
|
|
47
|
+
- Some missing files to npm package.
|
|
48
|
+
|
|
49
|
+
## v0.5.2 / 2016-06-06
|
|
50
|
+
### Fixed
|
|
51
|
+
- Shake output incorrect in the special length.
|
|
52
|
+
|
|
53
|
+
## v0.5.1 / 2015-10-27
|
|
54
|
+
### Fixed
|
|
55
|
+
- Version in package.json and bower.json.
|
|
56
|
+
|
|
57
|
+
## v0.5.0 / 2015-09-23
|
|
58
|
+
### Added
|
|
59
|
+
- Hash object with create/update interface.
|
|
60
|
+
|
|
61
|
+
## v0.4.1 / 2015-09-18
|
|
62
|
+
### Added
|
|
63
|
+
- Integer array output.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- Shake output incorrect when it's greater than 1088.
|
|
67
|
+
|
|
68
|
+
## v0.4.0 / 2015-09-17
|
|
69
|
+
### Added
|
|
70
|
+
- ArrayBuffer output.
|
|
71
|
+
- Shake alogirthms.
|
|
72
|
+
|
|
73
|
+
## v0.3.1 / 2015-05-22
|
|
74
|
+
### Fixed
|
|
75
|
+
- Some bugs.
|
|
76
|
+
|
|
77
|
+
## v0.3.0 / 2015-05-21
|
|
78
|
+
### Added
|
|
79
|
+
- Integer array input.
|
|
80
|
+
- ArrayBuffer input.
|
|
81
|
+
|
|
82
|
+
## v0.2.0 / 2015-04-04
|
|
83
|
+
### Added
|
|
84
|
+
- NIST's May 2014 SHA-3 version.
|
|
85
|
+
|
|
86
|
+
### Changed
|
|
87
|
+
- Rename original methods to keccak.
|
|
88
|
+
|
|
89
|
+
## v0.1.2 / 2015-02-27
|
|
90
|
+
### Changed
|
|
91
|
+
- Improve performance.
|
|
92
|
+
|
|
93
|
+
## v0.1.1 / 2015-02-26
|
|
94
|
+
### Changed
|
|
95
|
+
- Improve performance.
|
|
96
|
+
|
|
97
|
+
## v0.1.0 / 2015-02-23
|
|
98
|
+
### Added
|
|
99
|
+
- First version implementation.
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 enco
|
|
|
19
19
|
[Keccak-384 Online](http://emn178.github.io/online-tools/keccak_384.html)
|
|
20
20
|
[Keccak-256 Online](http://emn178.github.io/online-tools/keccak_256.html)
|
|
21
21
|
[Keccak-224 Online](http://emn178.github.io/online-tools/keccak_224.html)
|
|
22
|
-
[
|
|
23
|
-
[
|
|
22
|
+
[Shake128 Online](http://emn178.github.io/online-tools/shake_128.html)
|
|
23
|
+
[Shake256 Online](http://emn178.github.io/online-tools/shake_256.html)
|
|
24
24
|
|
|
25
25
|
## Download
|
|
26
26
|
[Compress](https://raw.github.com/emn178/js-sha3/master/build/sha3.min.js)
|
|
@@ -42,23 +42,27 @@ sha3_512('Message to hash');
|
|
|
42
42
|
sha3_384('Message to hash');
|
|
43
43
|
sha3_256('Message to hash');
|
|
44
44
|
sha3_224('Message to hash');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
keccak512('Message to hash');
|
|
46
|
+
keccak384('Message to hash');
|
|
47
|
+
keccak256('Message to hash');
|
|
48
|
+
keccak224('Message to hash');
|
|
49
|
+
shake128('Message to hash', 256);
|
|
50
|
+
shake256('Message to hash', 512);
|
|
51
|
+
cshake128('Message to hash', 256, 'function name', 'customization');
|
|
52
|
+
cshake256('Message to hash', 512, 'function name', 'customization');
|
|
53
|
+
kmac128('key', 'Message to hash', 256, 'customization');
|
|
54
|
+
kmac256('key', 'Message to hash', 512, 'customization');
|
|
51
55
|
|
|
52
56
|
// Support ArrayBuffer output
|
|
53
|
-
var buffer =
|
|
57
|
+
var buffer = keccak224.buffer('Message to hash');
|
|
54
58
|
|
|
55
59
|
// Support Array output
|
|
56
|
-
var buffer =
|
|
60
|
+
var buffer = keccak224.array('Message to hash');
|
|
57
61
|
|
|
58
62
|
// update hash
|
|
59
63
|
sha3_512.update('Message ').update('to ').update('hash').hex();
|
|
60
64
|
// specify shake output bits at first update
|
|
61
|
-
|
|
65
|
+
shake128.update('Message ', 256).update('to ').update('hash').hex();
|
|
62
66
|
|
|
63
67
|
// or to use create
|
|
64
68
|
var hash = sha3_512.create();
|
|
@@ -67,10 +71,16 @@ hash.update('...');
|
|
|
67
71
|
hash.hex();
|
|
68
72
|
|
|
69
73
|
// specify shake output bits when creating
|
|
70
|
-
var hash =
|
|
74
|
+
var hash = shake128.create(256);
|
|
71
75
|
hash.update('...');
|
|
72
76
|
hash.update('...');
|
|
73
77
|
hash.hex();
|
|
78
|
+
|
|
79
|
+
// specify cshake output bits, function name and customization when creating
|
|
80
|
+
var hash = cshake128.create(256, 'function name', 'customization');
|
|
81
|
+
|
|
82
|
+
// specify kmac key, output bits and customization when creating
|
|
83
|
+
var hash = kmac128.create('key', 256, 'customization');
|
|
74
84
|
```
|
|
75
85
|
If you use node.js, you should require the module first:
|
|
76
86
|
```JavaScript
|
|
@@ -78,12 +88,16 @@ sha3_512 = require('js-sha3').sha3_512;
|
|
|
78
88
|
sha3_384 = require('js-sha3').sha3_384;
|
|
79
89
|
sha3_256 = require('js-sha3').sha3_256;
|
|
80
90
|
sha3_224 = require('js-sha3').sha3_224;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
keccak512 = require('js-sha3').keccak512;
|
|
92
|
+
keccak384 = require('js-sha3').keccak384;
|
|
93
|
+
keccak256 = require('js-sha3').keccak256;
|
|
94
|
+
keccak224 = require('js-sha3').keccak224;
|
|
95
|
+
shake128 = require('js-sha3').shake128;
|
|
96
|
+
shake256 = require('js-sha3').shake256;
|
|
97
|
+
cshake128 = require('js-sha3').cshake128;
|
|
98
|
+
cshake256 = require('js-sha3').cshake256;
|
|
99
|
+
kmac128 = require('js-sha3').kmac128;
|
|
100
|
+
kmac256 = require('js-sha3').kmac256;
|
|
87
101
|
```
|
|
88
102
|
If you use TypeScript, you can import like this:
|
|
89
103
|
```TypeScript
|
|
@@ -129,46 +143,46 @@ sha3_224('The quick brown fox jumps over the lazy dog');
|
|
|
129
143
|
sha3_224('The quick brown fox jumps over the lazy dog.');
|
|
130
144
|
// 2d0708903833afabdd232a20201176e8b58c5be8a6fe74265ac54db0
|
|
131
145
|
|
|
132
|
-
|
|
146
|
+
keccak512('');
|
|
133
147
|
// 0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e
|
|
134
148
|
|
|
135
|
-
|
|
149
|
+
keccak512('The quick brown fox jumps over the lazy dog');
|
|
136
150
|
// d135bb84d0439dbac432247ee573a23ea7d3c9deb2a968eb31d47c4fb45f1ef4422d6c531b5b9bd6f449ebcc449ea94d0a8f05f62130fda612da53c79659f609
|
|
137
151
|
|
|
138
|
-
|
|
152
|
+
keccak512('The quick brown fox jumps over the lazy dog.');
|
|
139
153
|
// ab7192d2b11f51c7dd744e7b3441febf397ca07bf812cceae122ca4ded6387889064f8db9230f173f6d1ab6e24b6e50f065b039f799f5592360a6558eb52d760
|
|
140
154
|
|
|
141
|
-
|
|
155
|
+
keccak384('');
|
|
142
156
|
// 2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff
|
|
143
157
|
|
|
144
|
-
|
|
158
|
+
keccak384('The quick brown fox jumps over the lazy dog');
|
|
145
159
|
// 283990fa9d5fb731d786c5bbee94ea4db4910f18c62c03d173fc0a5e494422e8a0b3da7574dae7fa0baf005e504063b3
|
|
146
160
|
|
|
147
|
-
|
|
161
|
+
keccak384('The quick brown fox jumps over the lazy dog.');
|
|
148
162
|
// 9ad8e17325408eddb6edee6147f13856ad819bb7532668b605a24a2d958f88bd5c169e56dc4b2f89ffd325f6006d820b
|
|
149
163
|
|
|
150
|
-
|
|
164
|
+
keccak256('');
|
|
151
165
|
// c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
keccak256('The quick brown fox jumps over the lazy dog');
|
|
154
168
|
// 4d741b6f1eb29cb2a9b9911c82f56fa8d73b04959d3d9d222895df6c0b28aa15
|
|
155
169
|
|
|
156
|
-
|
|
170
|
+
keccak256('The quick brown fox jumps over the lazy dog.');
|
|
157
171
|
// 578951e24efd62a3d63a86f7cd19aaa53c898fe287d2552133220370240b572d
|
|
158
172
|
|
|
159
|
-
|
|
173
|
+
keccak224('');
|
|
160
174
|
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
|
|
161
175
|
|
|
162
|
-
|
|
176
|
+
keccak224('The quick brown fox jumps over the lazy dog');
|
|
163
177
|
// 310aee6b30c47350576ac2873fa89fd190cdc488442f3ef654cf23fe
|
|
164
178
|
|
|
165
|
-
|
|
179
|
+
keccak224('The quick brown fox jumps over the lazy dog.');
|
|
166
180
|
// c59d4eaeac728671c635ff645014e2afa935bebffdb5fbd207ffdeab
|
|
167
181
|
|
|
168
|
-
|
|
182
|
+
shake128('', 256);
|
|
169
183
|
// 7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26
|
|
170
184
|
|
|
171
|
-
|
|
185
|
+
shake256('', 512);
|
|
172
186
|
// 46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be
|
|
173
187
|
```
|
|
174
188
|
It also supports UTF-8 encoding:
|
|
@@ -187,16 +201,16 @@ sha3_256('中文');
|
|
|
187
201
|
sha3_224('中文');
|
|
188
202
|
// 106d169e10b61c2a2a05554d3e631ec94467f8316640f29545d163ee
|
|
189
203
|
|
|
190
|
-
|
|
204
|
+
keccak512('中文');
|
|
191
205
|
// 2f6a1bd50562230229af34b0ccf46b8754b89d23ae2c5bf7840b4acfcef86f87395edc0a00b2bfef53bafebe3b79de2e3e01cbd8169ddbb08bde888dcc893524
|
|
192
206
|
|
|
193
|
-
|
|
207
|
+
keccak384('中文');
|
|
194
208
|
// 743f64bb7544c6ed923be4741b738dde18b7cee384a3a09c4e01acaaac9f19222cdee137702bd3aa05dc198373d87d6c
|
|
195
209
|
|
|
196
|
-
|
|
210
|
+
keccak256('中文');
|
|
197
211
|
// 70a2b6579047f0a977fcb5e9120a4e07067bea9abb6916fbc2d13ffb9a4e4eee
|
|
198
212
|
|
|
199
|
-
|
|
213
|
+
keccak224('中文');
|
|
200
214
|
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
|
|
201
215
|
```
|
|
202
216
|
|
package/build/sha3.min.js
CHANGED
|
@@ -1,22 +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
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
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],t=[224,256,384,512],v=["hex","buffer","arrayBuffer","array"],ha=function(a,b,c){return function(e){return(new n(a,b,a)).update(e)[c]()}},ia=function(a,b,c){return function(e,g){return(new n(a,b,
|
|
11
|
-
g)).update(e)[c]()}},q=function(a,b){var c=ha(a,b,"hex");c.create=function(){return new n(a,b,a)};c.update=function(a){return c.create().update(a)};for(var e=0;e<v.length;++e){var g=v[e];c[g]=ha(a,b,g)}return c},t=[{name:"keccak",padding:[1,256,65536,16777216],bits:t,createMethod:q},{name:"sha3",padding:[6,1536,393216,100663296],bits:t,createMethod:q},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(a,b){var c=ia(a,b,"hex");c.create=function(c){return new n(a,
|
|
12
|
-
b,c)};c.update=function(a,b){return c.create(b).update(a)};for(var e=0;e<v.length;++e){var g=v[e];c[g]=ia(a,b,g)}return c}}],q={},ea=0;ea<t.length;++ea)for(var w=t[ea],fa=w.bits,x=0;x<fa.length;++x)q[w.name+"_"+fa[x]]=w.createMethod(fa[x],w.padding);n.prototype.update=function(a){var b="string"!=typeof a;b&&a.constructor==r.ArrayBuffer&&(a=new Uint8Array(a));for(var c=a.length,e=this.blocks,g=this.byteCount,k=this.blockCount,h=0,f=this.s,d,m;h<c;){if(this.reset)for(this.reset=!1,e[0]=this.block,d=
|
|
13
|
-
1;d<k+1;++d)e[d]=0;if(b)for(d=this.start;h<c&&d<g;++h)e[d>>2]|=a[h]<<p[d++&3];else for(d=this.start;h<c&&d<g;++h)m=a.charCodeAt(h),128>m?e[d>>2]|=m<<p[d++&3]:(2048>m?e[d>>2]|=(192|m>>6)<<p[d++&3]:(55296>m||57344<=m?e[d>>2]|=(224|m>>12)<<p[d++&3]:(m=65536+((m&1023)<<10|a.charCodeAt(++h)&1023),e[d>>2]|=(240|m>>18)<<p[d++&3],e[d>>2]|=(128|m>>12&63)<<p[d++&3]),e[d>>2]|=(128|m>>6&63)<<p[d++&3]),e[d>>2]|=(128|m&63)<<p[d++&3]);this.lastByteIndex=d;if(d>=g){this.start=d-g;this.block=e[k];for(d=0;d<k;++d)f[d]^=
|
|
14
|
-
e[d];u(f);this.reset=!0}else this.start=d}return this};n.prototype.finalize=function(){var a=this.blocks,b=this.lastByteIndex,c=this.blockCount,e=this.s;a[b>>2]|=this.padding[b&3];if(this.lastByteIndex==this.byteCount)for(a[0]=a[c],b=1;b<c+1;++b)a[b]=0;a[c-1]|=2147483648;for(b=0;b<c;++b)e[b]^=a[b];u(e)};n.prototype.toString=n.prototype.hex=function(){this.finalize();for(var a=this.blockCount,b=this.s,c=this.outputBlocks,e=this.extraBytes,g=0,k=0,h="",f;k<c;){for(g=0;g<a&&k<c;++g,++k)f=b[g],h+=l[f>>
|
|
15
|
-
4&15]+l[f&15]+l[f>>12&15]+l[f>>8&15]+l[f>>20&15]+l[f>>16&15]+l[f>>28&15]+l[f>>24&15];0==k%a&&(u(b),g=0)}e&&(f=b[g],0<e&&(h+=l[f>>4&15]+l[f&15]),1<e&&(h+=l[f>>12&15]+l[f>>8&15]),2<e&&(h+=l[f>>20&15]+l[f>>16&15]));return h};n.prototype.arrayBuffer=function(){this.finalize();var a=this.blockCount,b=this.s,c=this.outputBlocks,e=this.extraBytes,g=0,k=0,h=this.outputBits>>3,f;f=e?new ArrayBuffer(c+1<<2):new ArrayBuffer(h);for(var d=new Uint32Array(f);k<c;){for(g=0;g<a&&k<c;++g,++k)d[k]=b[g];0==k%a&&u(b)}e&&
|
|
16
|
-
(d[g]=b[g],f=f.slice(0,h));return f};n.prototype.buffer=n.prototype.arrayBuffer;n.prototype.digest=n.prototype.array=function(){this.finalize();for(var a=this.blockCount,b=this.s,c=this.outputBlocks,e=this.extraBytes,g=0,k=0,h=[],f,d;k<c;){for(g=0;g<a&&k<c;++g,++k)f=k<<2,d=b[g],h[f]=d&255,h[f+1]=d>>8&255,h[f+2]=d>>16&255,h[f+3]=d>>24&255;0==k%a&&u(b)}e&&(f=k<<2,d=b[g],0<e&&(h[f]=d&255),1<e&&(h[f+1]=d>>8&255),2<e&&(h[f+2]=d>>16&255));return h};var u=function(a){var b,c,e,g,k,h,f,d,m,l,n,p,y,q,r,t,
|
|
17
|
-
u,v,w,x,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,aa,ba,ca,da;for(e=0;48>e;e+=2)g=a[0]^a[10]^a[20]^a[30]^a[40],k=a[1]^a[11]^a[21]^a[31]^a[41],h=a[2]^a[12]^a[22]^a[32]^a[42],f=a[3]^a[13]^a[23]^a[33]^a[43],d=a[4]^a[14]^a[24]^a[34]^a[44],m=a[5]^a[15]^a[25]^a[35]^a[45],l=a[6]^a[16]^a[26]^a[36]^a[46],n=a[7]^a[17]^a[27]^a[37]^a[47],p=a[8]^a[18]^a[28]^a[38]^a[48],y=a[9]^a[19]^a[29]^a[39]^a[49],b=p^(h<<1|f>>>31),c=y^(f<<1|h>>>31),a[0]^=b,a[1]^=c,a[10]^=b,a[11]^=c,a[20]^=b,a[21]^=c,a[30]^=b,a[31]^=
|
|
18
|
-
c,a[40]^=b,a[41]^=c,b=g^(d<<1|m>>>31),c=k^(m<<1|d>>>31),a[2]^=b,a[3]^=c,a[12]^=b,a[13]^=c,a[22]^=b,a[23]^=c,a[32]^=b,a[33]^=c,a[42]^=b,a[43]^=c,b=h^(l<<1|n>>>31),c=f^(n<<1|l>>>31),a[4]^=b,a[5]^=c,a[14]^=b,a[15]^=c,a[24]^=b,a[25]^=c,a[34]^=b,a[35]^=c,a[44]^=b,a[45]^=c,b=d^(p<<1|y>>>31),c=m^(y<<1|p>>>31),a[6]^=b,a[7]^=c,a[16]^=b,a[17]^=c,a[26]^=b,a[27]^=c,a[36]^=b,a[37]^=c,a[46]^=b,a[47]^=c,b=l^(g<<1|k>>>31),c=n^(k<<1|g>>>31),a[8]^=b,a[9]^=c,a[18]^=b,a[19]^=c,a[28]^=b,a[29]^=c,a[38]^=b,a[39]^=c,a[48]^=
|
|
19
|
-
b,a[49]^=c,b=a[0],c=a[1],M=a[11]<<4|a[10]>>>28,N=a[10]<<4|a[11]>>>28,t=a[20]<<3|a[21]>>>29,u=a[21]<<3|a[20]>>>29,aa=a[31]<<9|a[30]>>>23,ba=a[30]<<9|a[31]>>>23,I=a[40]<<18|a[41]>>>14,J=a[41]<<18|a[40]>>>14,A=a[2]<<1|a[3]>>>31,B=a[3]<<1|a[2]>>>31,g=a[13]<<12|a[12]>>>20,k=a[12]<<12|a[13]>>>20,O=a[22]<<10|a[23]>>>22,P=a[23]<<10|a[22]>>>22,v=a[33]<<13|a[32]>>>19,w=a[32]<<13|a[33]>>>19,ca=a[42]<<2|a[43]>>>30,da=a[43]<<2|a[42]>>>30,U=a[5]<<30|a[4]>>>2,V=a[4]<<30|a[5]>>>2,C=a[14]<<6|a[15]>>>26,D=a[15]<<6|
|
|
20
|
-
a[14]>>>26,h=a[25]<<11|a[24]>>>21,f=a[24]<<11|a[25]>>>21,Q=a[34]<<15|a[35]>>>17,R=a[35]<<15|a[34]>>>17,x=a[45]<<29|a[44]>>>3,z=a[44]<<29|a[45]>>>3,p=a[6]<<28|a[7]>>>4,y=a[7]<<28|a[6]>>>4,W=a[17]<<23|a[16]>>>9,X=a[16]<<23|a[17]>>>9,E=a[26]<<25|a[27]>>>7,F=a[27]<<25|a[26]>>>7,d=a[36]<<21|a[37]>>>11,m=a[37]<<21|a[36]>>>11,S=a[47]<<24|a[46]>>>8,T=a[46]<<24|a[47]>>>8,K=a[8]<<27|a[9]>>>5,L=a[9]<<27|a[8]>>>5,q=a[18]<<20|a[19]>>>12,r=a[19]<<20|a[18]>>>12,Y=a[29]<<7|a[28]>>>25,Z=a[28]<<7|a[29]>>>25,G=a[38]<<
|
|
21
|
-
8|a[39]>>>24,H=a[39]<<8|a[38]>>>24,l=a[48]<<14|a[49]>>>18,n=a[49]<<14|a[48]>>>18,a[0]=b^~g&h,a[1]=c^~k&f,a[10]=p^~q&t,a[11]=y^~r&u,a[20]=A^~C&E,a[21]=B^~D&F,a[30]=K^~M&O,a[31]=L^~N&P,a[40]=U^~W&Y,a[41]=V^~X&Z,a[2]=g^~h&d,a[3]=k^~f&m,a[12]=q^~t&v,a[13]=r^~u&w,a[22]=C^~E&G,a[23]=D^~F&H,a[32]=M^~O&Q,a[33]=N^~P&R,a[42]=W^~Y&aa,a[43]=X^~Z&ba,a[4]=h^~d&l,a[5]=f^~m&n,a[14]=t^~v&x,a[15]=u^~w&z,a[24]=E^~G&I,a[25]=F^~H&J,a[34]=O^~Q&S,a[35]=P^~R&T,a[44]=Y^~aa&ca,a[45]=Z^~ba&da,a[6]=d^~l&b,a[7]=m^~n&c,a[16]=
|
|
22
|
-
v^~x&p,a[17]=w^~z&y,a[26]=G^~I&A,a[27]=H^~J&B,a[36]=Q^~S&K,a[37]=R^~T&L,a[46]=aa^~ca&U,a[47]=ba^~da&V,a[8]=l^~b&g,a[9]=n^~c&k,a[18]=x^~p&q,a[19]=z^~y&r,a[28]=I^~A&C,a[29]=J^~B&D,a[38]=S^~K&M,a[39]=T^~L&N,a[48]=ca^~U&W,a[49]=da^~V&X,a[0]^=ga[e],a[1]^=ga[e+1]};if(ka)module.exports=q;else if(r)for(var ja in q)r[ja]=q[ja]})(this);
|
|
1
|
+
/**
|
|
2
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
|
+
*
|
|
4
|
+
* @version 0.7.0
|
|
5
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
+
* @copyright Chen, Yi-Cyuan 2015-2017
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/
|
|
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 s=!i.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,a="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]()}},v=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},B=function(t,e,r){return function(e,n,i,o){return S["cshake"+t].update(e,n,i,o)[r]()}},g=function(t,e,r){return function(e,n,i,o){return S["kmac"+t].update(e,n,i,o)[r]()}},w=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)},w(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=v(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)},w(n,v,e,r)}},{name:"cshake",padding:c,bits:l,createMethod:function(e,r){var n=b[e],i=B(e,0,"hex");return i.create=function(i,o,s){return o||s?new t(e,r,i).bytepad([o,s],n):S["shake"+e].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},w(i,B,e,r)}},{name:"kmac",padding:c,bits:l,createMethod:function(t,r){var n=b[t],i=g(t,0,"hex");return i.create=function(i,o,s){return new e(t,r,o).bytepad(["KMAC",s],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},w(i,g,t,r)}}],S={},C=[],x=0;x<k.length;++x)for(var m=k[x],O=m.bits,z=0;z<O.length;++z){var N=m.name+"_"+O[z];if(C.push(N),S[N]=m.createMethod(O[z],m.padding),"sha3"!==m.name){var j=m.name+O[z];C.push(j),S[j]=S[N]}}t.prototype.update=function(t){if(!this.finalized){var e,n=typeof t;if("string"!==n){if("object"!==n)throw r;if(null===t)throw r;if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw r;e=!0}for(var i,o,s=this.blocks,a=this.byteCount,f=t.length,c=this.blockCount,p=0,d=this.s;p<f;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(e)for(i=this.start;p<f&&i<a;++p)s[i>>2]|=t[p]<<h[3&i++];else for(i=this.start;p<f&&i<a;++p)(o=t.charCodeAt(p))<128?s[i>>2]|=o<<h[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<h[3&i++],s[i>>2]|=(128|63&o)<<h[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<h[3&i++],s[i>>2]|=(128|o>>6&63)<<h[3&i++],s[i>>2]|=(128|63&o)<<h[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++p)),s[i>>2]|=(240|o>>18)<<h[3&i++],s[i>>2]|=(128|o>>12&63)<<h[3&i++],s[i>>2]|=(128|o>>6&63)<<h[3&i++],s[i>>2]|=(128|63&o)<<h[3&i++]);if(this.lastByteIndex=i,i>=a){for(this.start=i-a,this.block=s[c],i=0;i<c;++i)d[i]^=s[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 r;if(null===t)throw r;if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw r;e=!0}var i=0,o=t.length;if(e)i=o;else for(var s=0;s<t.length;++s){var a=t.charCodeAt(s);a<128?i+=1:a<2048?i+=2:a<55296||a>=57344?i+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),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,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=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];s%e==0&&(J(r),o=0)}return i&&(t=r[o],a+=f[t>>4&15]+f[15&t],i>1&&(a+=f[t>>12&15]+f[t>>8&15]),i>2&&(a+=f[t>>20&15]+f[t>>16&15])),a},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)u[s]=r[o];s%e==0&&J(r)}return i&&(u[o]=r[o],t=t.slice(0,a)),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,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&J(n)}return o&&(t=a<<2,e=n[s],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,s,a,u,f,c,h,d,l,y,b,A,v,B,g,w,_,k,S,C,x,m,O,z,N,j,J,M,H,I,R,E,U,V,F,D,W,Y,K,q,G,L,P,Q,T,X,Z,$,tt,et,rt,nt,it,ot,st,at,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],s=t[2]^t[12]^t[22]^t[32]^t[42],a=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])^(s<<1|a>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>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=s^(c<<1|h>>>31),r=a^(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,z=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,at=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,I=t[2]<<1|t[3]>>>31,R=t[3]<<1|t[2]>>>31,A=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,j=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,E=t[14]<<6|t[15]>>>26,U=t[15]<<6|t[14]>>>26,B=t[25]<<11|t[24]>>>21,g=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,M=t[45]<<29|t[44]>>>3,H=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,w=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,O=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=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&B,t[1]=b^~v&g,t[10]=C^~m&z,t[11]=x^~O&N,t[20]=I^~E&V,t[21]=R^~U&F,t[30]=q^~L&Q,t[31]=G^~P&T,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=A^~B&w,t[3]=v^~g&_,t[12]=m^~z&j,t[13]=O^~N&J,t[22]=E^~V&D,t[23]=U^~F&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=B^~w&k,t[5]=g^~_&S,t[14]=z^~j&M,t[15]=N^~J&H,t[24]=V^~D&Y,t[25]=F^~W&K,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~at&ft,t[45]=st^~ut&ct,t[6]=w^~k&y,t[7]=_^~S&b,t[16]=j^~M&C,t[17]=J^~H&x,t[26]=D^~Y&I,t[27]=W^~K&R,t[36]=X^~$&q,t[37]=Z^~tt&G,t[46]=at^~ft&et,t[47]=ut^~ct&rt,t[8]=k^~y&A,t[9]=S^~b&v,t[18]=M^~C&m,t[19]=H^~x&O,t[28]=Y^~I&E,t[29]=K^~R&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(s)module.exports=S;else{for(x=0;x<C.length;++x)i[C[x]]=S[C[x]];a&&define(function(){return S})}}();
|
package/index.d.ts
CHANGED
|
@@ -80,6 +80,68 @@ interface ShakeHash {
|
|
|
80
80
|
update(message: Message, outputBits: number): Hasher;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
interface CshakeHash {
|
|
84
|
+
/**
|
|
85
|
+
* Hash and return hex string.
|
|
86
|
+
*
|
|
87
|
+
* @param message The message you want to hash.
|
|
88
|
+
* @param outputBits The length of output.
|
|
89
|
+
* @param functionName The function name string.
|
|
90
|
+
* @param customization The customization string.
|
|
91
|
+
*/
|
|
92
|
+
(message: Message, outputBits: number, functionName: Message, customization: Message): string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a hash object.
|
|
96
|
+
*
|
|
97
|
+
* @param outputBits The length of output.
|
|
98
|
+
* @param functionName The function name string.
|
|
99
|
+
* @param customization The customization string.
|
|
100
|
+
*/
|
|
101
|
+
create(outputBits: number, functionName: Message, customization: Message): Hasher;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Create a hash object and hash message.
|
|
105
|
+
*
|
|
106
|
+
* @param message The message you want to hash.
|
|
107
|
+
* @param outputBits The length of output.
|
|
108
|
+
* @param functionName The function name string.
|
|
109
|
+
* @param customization The customization string.
|
|
110
|
+
*/
|
|
111
|
+
update(message: Message, outputBits: number, functionName: Message, customization: Message): Hasher;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface KmacHash {
|
|
115
|
+
/**
|
|
116
|
+
* Hash and return hex string.
|
|
117
|
+
*
|
|
118
|
+
* @param key The key string.
|
|
119
|
+
* @param message The message you want to hash.
|
|
120
|
+
* @param outputBits The length of output.
|
|
121
|
+
* @param customization The customization string.
|
|
122
|
+
*/
|
|
123
|
+
(key: Message, message: Message, outputBits: number, customization: Message): string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Create a hash object.
|
|
127
|
+
*
|
|
128
|
+
* @param key The key string.
|
|
129
|
+
* @param outputBits The length of output.
|
|
130
|
+
* @param customization The customization string.
|
|
131
|
+
*/
|
|
132
|
+
create(key: Message, outputBits: number, customization: Message): Hasher;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Create a hash object and hash message.
|
|
136
|
+
*
|
|
137
|
+
* @param key The key string.
|
|
138
|
+
* @param message The message you want to hash.
|
|
139
|
+
* @param outputBits The length of output.
|
|
140
|
+
* @param customization The customization string.
|
|
141
|
+
*/
|
|
142
|
+
update(key: Message, message: Message, outputBits: number, customization: Message): Hasher;
|
|
143
|
+
}
|
|
144
|
+
|
|
83
145
|
export var sha3_512: Hash;
|
|
84
146
|
export var sha3_384: Hash;
|
|
85
147
|
export var sha3_256: Hash;
|
|
@@ -88,5 +150,19 @@ export var keccak_512: Hash;
|
|
|
88
150
|
export var keccak_384: Hash;
|
|
89
151
|
export var keccak_256: Hash;
|
|
90
152
|
export var keccak_224: Hash;
|
|
153
|
+
export var keccak512: Hash;
|
|
154
|
+
export var keccak384: Hash;
|
|
155
|
+
export var keccak256: Hash;
|
|
156
|
+
export var keccak224: Hash;
|
|
91
157
|
export var shake_128: ShakeHash;
|
|
92
158
|
export var shake_256: ShakeHash;
|
|
159
|
+
export var shake128: ShakeHash;
|
|
160
|
+
export var shake256: ShakeHash;
|
|
161
|
+
export var cshake_128: CshakeHash;
|
|
162
|
+
export var cshake_256: CshakeHash;
|
|
163
|
+
export var cshake128: CshakeHash;
|
|
164
|
+
export var cshake256: CshakeHash;
|
|
165
|
+
export var kmac_128: KmacHash;
|
|
166
|
+
export var kmac_256: KmacHash;
|
|
167
|
+
export var kmac128: KmacHash;
|
|
168
|
+
export var kmac256: KmacHash;
|
package/package.json
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "js-sha3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 encoding.",
|
|
5
|
-
"main": "src/sha3.js",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"sha3"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "js-sha3",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 encoding.",
|
|
5
|
+
"main": "src/sha3.js",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"expect.js": "~0.3.1",
|
|
8
|
+
"mocha": "~2.3.4",
|
|
9
|
+
"nyc": "^11.3.0",
|
|
10
|
+
"uglify-js": "^3.1.9",
|
|
11
|
+
"webworker-threads": "^0.7.13"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "nyc mocha tests/node-test.js",
|
|
15
|
+
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
|
|
16
|
+
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
|
17
|
+
"build": "uglifyjs src/sha3.js -c -m --comments --output build/sha3.min.js"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/emn178/js-sha3.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"sha3",
|
|
25
|
+
"keccak",
|
|
26
|
+
"shake",
|
|
27
|
+
"cshake",
|
|
28
|
+
"kmac",
|
|
29
|
+
"hash",
|
|
30
|
+
"encryption",
|
|
31
|
+
"cryptography",
|
|
32
|
+
"HMAC"
|
|
33
|
+
],
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"author": "Chen, Yi-Cyuan <emn178@gmail.com>",
|
|
36
|
+
"homepage": "https://github.com/emn178/js-sha3",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/emn178/js-sha3/issues"
|
|
39
|
+
},
|
|
40
|
+
"nyc": {
|
|
41
|
+
"exclude": [
|
|
42
|
+
"tests"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|