uint8arrays
Version:
Utility functions to make dealing with Uint8Arrays easier
17 lines (13 loc) • 348 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function xor(a, b) {
if (a.length !== b.length) {
throw new Error('Inputs should have the same length');
}
const result = new Uint8Array(a.length);
for (let i = 0; i < a.length; i++) {
result[i] = a[i] ^ b[i];
}
return result;
}
exports.xor = xor;