### Fixed

- Incorrect hash for `DataView` input, and for `Int8Array` with negative values.
- Throws `ArrayBuffer is not defined` in browsers without `ArrayBuffer`.
- Throws `global is not defined` in browsers with a `process` polyfill (e.g. BrowserFS) and Electron renderers.

### Changed
- Multi-byte typed arrays such as `Uint16Array`, `Uint32Array` and `Float32Array` are now hashed by their underlying bytes, the same as Node.js `crypto` and Web Crypto. Previously each element was treated as one byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yi-Cyuan Chen
2026-11-18 13:32:01 +08:00
co-authored by Claude Opus 5.5
parent 290d679fbd
commit 9c5eb82a0d
12 changed files with 90 additions and 21 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ keccak224('中文');
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
```
It also supports byte `Array`, `Uint8Array`, `ArrayBuffer` input:
It also supports byte `Array`, `Uint8Array`, `ArrayBuffer` and other `ArrayBuffer` views as input (their underlying bytes are hashed):
Code
```JavaScript