Skip to content
File

Blob: src/worker/common/bytes.ts

typescript11 lines
1/**
2 * Compare byte slices without allocating string copies.
3 */
4export function bytesEqual(left: Uint8Array, right: Uint8Array): boolean {
5 if (left.byteLength !== right.byteLength) return false;
6 for (let index = 0; index < left.byteLength; index++) {
7 if (left[index] !== right[index]) return false;
8 }
9 return true;
10}