Suite of AT Protocol TypeScript libraries built on web standards
21
fork

Configure Feed

Select the types of activity you want to include in your feed.

at lex 19 lines 451 B view raw
1import { allocUnsafe } from "./alloc.ts"; 2import { asUint8Array } from "./util.ts"; 3 4/** 5 * Returns the xor distance between two Uint8Arrays 6 */ 7export function xor(a: Uint8Array, b: Uint8Array): Uint8Array { 8 if (a.length !== b.length) { 9 throw new Error("Inputs should have the same length"); 10 } 11 12 const result = allocUnsafe(a.length); 13 14 for (let i = 0; i < a.length; i++) { 15 result[i] = a[i] ^ b[i]; 16 } 17 18 return asUint8Array(result); 19}