function xor(hex1, hex2) { const buf1 = Buffer.from(hex1, 'hex'); const buf2 = Buffer.from(hex2, 'hex'); const bufResult = buf1.map((b, i) => b ^ buf2[i]); return bufResult.toString('hex'); }