### Added

- ParallelHash128, ParallelHash256, ParallelHashXOF128, and ParallelHashXOF256 (NIST SP 800-185)
This commit is contained in:
Yi-Cyuan Chen
2026-08-07 08:18:38 +08:00
parent d506b22f67
commit a67f74cf2c
12 changed files with 654 additions and 15 deletions
+26 -3
View File
@@ -4,7 +4,7 @@
[![Coverage Status](https://coveralls.io/repos/emn178/js-sha3/badge.svg?branch=master)](https://coveralls.io/r/emn178/js-sha3?branch=master)
[![NPM](https://nodei.co/npm/js-sha3.png?stars&downloads)](https://nodei.co/npm/js-sha3/)
A simple SHA-3 / Keccak / SHAKE / cSHAKE / KMAC / TupleHash hash function for JavaScript supports UTF-8 encoding.
A simple SHA-3 / Keccak / SHAKE / cSHAKE / KMAC / TupleHash / ParallelHash hash function for JavaScript supports UTF-8 encoding.
## Notice
* v0.8.0+ will throw an error if try to update hash after finalize.
@@ -32,6 +32,10 @@ A simple SHA-3 / Keccak / SHAKE / cSHAKE / KMAC / TupleHash hash function for Ja
[TupleHash256 Online](http://emn178.github.io/online-tools/tuplehash256/)
[TupleHashXOF128 Online](http://emn178.github.io/online-tools/tuplehashxof128/)
[TupleHashXOF256 Online](http://emn178.github.io/online-tools/tuplehashxof256/)
[ParallelHash128 Online](http://emn178.github.io/online-tools/parallelhash128/)
[ParallelHash256 Online](http://emn178.github.io/online-tools/parallelhash256/)
[ParallelHashXOF128 Online](http://emn178.github.io/online-tools/parallelhashxof128/)
[ParallelHashXOF256 Online](http://emn178.github.io/online-tools/parallelhashxof256/)
## Download
[Compress](https://raw.github.com/emn178/js-sha3/master/build/sha3.min.js)
@@ -69,6 +73,10 @@ tuplehash128(['abc', 'd'], 256, 'customization');
tuplehash256(['abc', 'd'], 512, 'customization');
tuplehashxof128(['abc', 'd'], 256, 'customization');
tuplehashxof256(['abc', 'd'], 512, 'customization');
parallelhash128('Message to hash', 8, 256, 'customization');
parallelhash256('Message to hash', 8, 512, 'customization');
parallelhashxof128('Message to hash', 8, 256, 'customization');
parallelhashxof256('Message to hash', 8, 512, 'customization');
// Support ArrayBuffer output
var arrayBuffer = keccak224.arrayBuffer('Message to hash');
@@ -122,6 +130,13 @@ tupleHash.updateChunk([0x63]);
tupleHash.beginInput(1);
tupleHash.updateChunk([0x64]);
tupleHash.hex();
// ParallelHash: hash one large input in fixed-size blocks.
parallelhash128('Message to hash', 8, 256, '');
parallelhash128.create(8, 256, '')
.update('Message ')
.update('to hash')
.hex();
```
### Node.js
If you use node.js, you should require the module first:
@@ -146,7 +161,11 @@ const {
tuplehash128,
tuplehash256,
tuplehashxof128,
tuplehashxof256
tuplehashxof256,
parallelhash128,
parallelhash256,
parallelhashxof128,
parallelhashxof256
} = require('js-sha3');
```
@@ -173,7 +192,11 @@ import {
tuplehash128,
tuplehash256,
tuplehashxof128,
tuplehashxof256
tuplehashxof256,
parallelhash128,
parallelhash256,
parallelhashxof128,
parallelhashxof256
} from 'js-sha3';
```