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/index.d.ts
CHANGED
|
@@ -42,6 +42,34 @@ interface Hash {
|
|
|
42
42
|
*/
|
|
43
43
|
(message: Message): string;
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Hash and return hex string.
|
|
47
|
+
*
|
|
48
|
+
* @param message The message you want to hash.
|
|
49
|
+
*/
|
|
50
|
+
hex(message: Message): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Hash and return ArrayBuffer.
|
|
54
|
+
*
|
|
55
|
+
* @param message The message you want to hash.
|
|
56
|
+
*/
|
|
57
|
+
arrayBuffer(message: Message): ArrayBuffer;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Hash and return integer array.
|
|
61
|
+
*
|
|
62
|
+
* @param message The message you want to hash.
|
|
63
|
+
*/
|
|
64
|
+
digest(message: Message): number[];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Hash and return integer array.
|
|
68
|
+
*
|
|
69
|
+
* @param message The message you want to hash.
|
|
70
|
+
*/
|
|
71
|
+
array(message: Message): number[];
|
|
72
|
+
|
|
45
73
|
/**
|
|
46
74
|
* Create a hash object.
|
|
47
75
|
*/
|
|
@@ -64,10 +92,43 @@ interface ShakeHash {
|
|
|
64
92
|
*/
|
|
65
93
|
(message: Message, outputBits: number): string;
|
|
66
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Hash and return hex string.
|
|
97
|
+
*
|
|
98
|
+
* @param message The message you want to hash.
|
|
99
|
+
* @param outputBits The length of output.
|
|
100
|
+
*/
|
|
101
|
+
hex(message: Message, outputBits: number): string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Hash and return ArrayBuffer.
|
|
105
|
+
*
|
|
106
|
+
* @param message The message you want to hash.
|
|
107
|
+
* @param outputBits The length of output.
|
|
108
|
+
*/
|
|
109
|
+
arrayBuffer(message: Message, outputBits: number): ArrayBuffer;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Hash and return integer array.
|
|
113
|
+
*
|
|
114
|
+
* @param message The message you want to hash.
|
|
115
|
+
* @param outputBits The length of output.
|
|
116
|
+
*/
|
|
117
|
+
digest(message: Message, outputBits: number): number[];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Hash and return integer array.
|
|
121
|
+
*
|
|
122
|
+
* @param message The message you want to hash.
|
|
123
|
+
* @param outputBits The length of output.
|
|
124
|
+
*/
|
|
125
|
+
array(message: Message, outputBits: number): number[];
|
|
126
|
+
|
|
67
127
|
/**
|
|
68
128
|
* Create a hash object.
|
|
69
129
|
*
|
|
70
130
|
* @param outputBits The length of output.
|
|
131
|
+
* @param outputBits The length of output.
|
|
71
132
|
*/
|
|
72
133
|
create(outputBits: number): Hasher;
|
|
73
134
|
|
|
@@ -80,6 +141,156 @@ interface ShakeHash {
|
|
|
80
141
|
update(message: Message, outputBits: number): Hasher;
|
|
81
142
|
}
|
|
82
143
|
|
|
144
|
+
interface CshakeHash {
|
|
145
|
+
/**
|
|
146
|
+
* Hash and return hex string.
|
|
147
|
+
*
|
|
148
|
+
* @param message The message you want to hash.
|
|
149
|
+
* @param outputBits The length of output.
|
|
150
|
+
* @param functionName The function name string.
|
|
151
|
+
* @param customization The customization string.
|
|
152
|
+
*/
|
|
153
|
+
(message: Message, outputBits: number, functionName: Message, customization: Message): string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Hash and return hex string.
|
|
157
|
+
*
|
|
158
|
+
* @param message The message you want to hash.
|
|
159
|
+
* @param outputBits The length of output.
|
|
160
|
+
* @param functionName The function name string.
|
|
161
|
+
* @param customization The customization string.
|
|
162
|
+
*/
|
|
163
|
+
hex(message: Message, outputBits: number, functionName: Message, customization: Message): string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Hash and return ArrayBuffer.
|
|
167
|
+
*
|
|
168
|
+
* @param message The message you want to hash.
|
|
169
|
+
* @param outputBits The length of output.
|
|
170
|
+
* @param functionName The function name string.
|
|
171
|
+
* @param customization The customization string.
|
|
172
|
+
*/
|
|
173
|
+
arrayBuffer(message: Message, outputBits: number, functionName: Message, customization: Message): ArrayBuffer;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Hash and return integer array.
|
|
177
|
+
*
|
|
178
|
+
* @param message The message you want to hash.
|
|
179
|
+
* @param outputBits The length of output.
|
|
180
|
+
* @param functionName The function name string.
|
|
181
|
+
* @param customization The customization string.
|
|
182
|
+
*/
|
|
183
|
+
digest(message: Message, outputBits: number, functionName: Message, customization: Message): number[];
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Hash and return integer array.
|
|
187
|
+
*
|
|
188
|
+
* @param message The message you want to hash.
|
|
189
|
+
* @param outputBits The length of output.
|
|
190
|
+
* @param functionName The function name string.
|
|
191
|
+
* @param customization The customization string.
|
|
192
|
+
*/
|
|
193
|
+
array(message: Message, outputBits: number, functionName: Message, customization: Message): number[];
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Create a hash object.
|
|
197
|
+
*
|
|
198
|
+
* @param outputBits The length of output.
|
|
199
|
+
* @param outputBits The length of output.
|
|
200
|
+
*/
|
|
201
|
+
create(outputBits: number): Hasher;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Create a hash object.
|
|
205
|
+
*
|
|
206
|
+
* @param outputBits The length of output.
|
|
207
|
+
* @param functionName The function name string.
|
|
208
|
+
* @param customization The customization string.
|
|
209
|
+
*/
|
|
210
|
+
create(outputBits: number, functionName: Message, customization: Message): Hasher;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Create a hash object and hash message.
|
|
214
|
+
*
|
|
215
|
+
* @param message The message you want to hash.
|
|
216
|
+
* @param outputBits The length of output.
|
|
217
|
+
* @param functionName The function name string.
|
|
218
|
+
* @param customization The customization string.
|
|
219
|
+
*/
|
|
220
|
+
update(message: Message, outputBits: number, functionName: Message, customization: Message): Hasher;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface KmacHash {
|
|
224
|
+
/**
|
|
225
|
+
* Hash and return hex string.
|
|
226
|
+
*
|
|
227
|
+
* @param key The key string.
|
|
228
|
+
* @param message The message you want to hash.
|
|
229
|
+
* @param outputBits The length of output.
|
|
230
|
+
* @param customization The customization string.
|
|
231
|
+
*/
|
|
232
|
+
(key: Message, message: Message, outputBits: number, customization: Message): string;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Hash and return hex string.
|
|
236
|
+
*
|
|
237
|
+
* @param key The key string.
|
|
238
|
+
* @param message The message you want to hash.
|
|
239
|
+
* @param outputBits The length of output.
|
|
240
|
+
* @param customization The customization string.
|
|
241
|
+
*/
|
|
242
|
+
hex(key: Message, message: Message, outputBits: number, customization: Message): string;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Hash and return ArrayBuffer.
|
|
246
|
+
*
|
|
247
|
+
* @param key The key string.
|
|
248
|
+
* @param message The message you want to hash.
|
|
249
|
+
* @param outputBits The length of output.
|
|
250
|
+
* @param customization The customization string.
|
|
251
|
+
*/
|
|
252
|
+
arrayBuffer(key: Message, message: Message, outputBits: number, customization: Message): ArrayBuffer;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Hash and return integer array.
|
|
256
|
+
*
|
|
257
|
+
* @param key The key string.
|
|
258
|
+
* @param message The message you want to hash.
|
|
259
|
+
* @param outputBits The length of output.
|
|
260
|
+
* @param customization The customization string.
|
|
261
|
+
*/
|
|
262
|
+
digest(key: Message, message: Message, outputBits: number, customization: Message): number[];
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Hash and return integer array.
|
|
266
|
+
*
|
|
267
|
+
* @param key The key string.
|
|
268
|
+
* @param message The message you want to hash.
|
|
269
|
+
* @param outputBits The length of output.
|
|
270
|
+
* @param customization The customization string.
|
|
271
|
+
*/
|
|
272
|
+
array(key: Message, message: Message, outputBits: number, customization: Message): number[];
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Create a hash object.
|
|
276
|
+
*
|
|
277
|
+
* @param key The key string.
|
|
278
|
+
* @param outputBits The length of output.
|
|
279
|
+
* @param customization The customization string.
|
|
280
|
+
*/
|
|
281
|
+
create(key: Message, outputBits: number, customization: Message): Hasher;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Create a hash object and hash message.
|
|
285
|
+
*
|
|
286
|
+
* @param key The key string.
|
|
287
|
+
* @param message The message you want to hash.
|
|
288
|
+
* @param outputBits The length of output.
|
|
289
|
+
* @param customization The customization string.
|
|
290
|
+
*/
|
|
291
|
+
update(key: Message, message: Message, outputBits: number, customization: Message): Hasher;
|
|
292
|
+
}
|
|
293
|
+
|
|
83
294
|
export var sha3_512: Hash;
|
|
84
295
|
export var sha3_384: Hash;
|
|
85
296
|
export var sha3_256: Hash;
|
|
@@ -88,5 +299,19 @@ export var keccak_512: Hash;
|
|
|
88
299
|
export var keccak_384: Hash;
|
|
89
300
|
export var keccak_256: Hash;
|
|
90
301
|
export var keccak_224: Hash;
|
|
302
|
+
export var keccak512: Hash;
|
|
303
|
+
export var keccak384: Hash;
|
|
304
|
+
export var keccak256: Hash;
|
|
305
|
+
export var keccak224: Hash;
|
|
91
306
|
export var shake_128: ShakeHash;
|
|
92
307
|
export var shake_256: ShakeHash;
|
|
308
|
+
export var shake128: ShakeHash;
|
|
309
|
+
export var shake256: ShakeHash;
|
|
310
|
+
export var cshake_128: CshakeHash;
|
|
311
|
+
export var cshake_256: CshakeHash;
|
|
312
|
+
export var cshake128: CshakeHash;
|
|
313
|
+
export var cshake256: CshakeHash;
|
|
314
|
+
export var kmac_128: KmacHash;
|
|
315
|
+
export var kmac_256: KmacHash;
|
|
316
|
+
export var kmac128: KmacHash;
|
|
317
|
+
export var kmac256: KmacHash;
|
package/package.json
CHANGED
|
@@ -1,39 +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
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "js-sha3",
|
|
3
|
+
"version": "0.8.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
|
+
}
|