Spaces:
Paused
Paused
Download node_modules/@peculiar/utils/build/esm/bytes/equal.js from Leon4gr45/augmenttoolkit: direct link, hf CLI and curl.
- Browser
- Download file 500 Bytes
-
https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40peculiar/utils/build/esm/bytes/equal.js
- Command line
-
hf download hf://spaces/Leon4gr45/augmenttoolkit/node_modules/@peculiar/utils/build/esm/bytes/equal.js
-
curl -L -o equal.js https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40peculiar/utils/build/esm/bytes/equal.js
500 Bytes
| import { toUint8Array } from "./buffer-source.js"; | |
| export function equal(a, b, options = {}) { | |
| const left = toUint8Array(a); | |
| const right = toUint8Array(b); | |
| if (!options.constantTime && left.byteLength !== right.byteLength) { | |
| return false; | |
| } | |
| const length = Math.max(left.byteLength, right.byteLength); | |
| let diff = left.byteLength ^ right.byteLength; | |
| for (let i = 0; i < length; i++) { | |
| diff |= (left[i] ?? 0) ^ (right[i] ?? 0); | |
| } | |
| return diff === 0; | |
| } | |