bitcore-payment-codes-cash
Version:
Payment Codes (BIP47) support for Bitcoin Cash
20 lines (17 loc) • 445 B
JavaScript
// From https://github.com/czzarr/node-bitwise-xor/blob/master/index.js
function xor(a, b) {
if (!Buffer.isBuffer(a)) a = new Buffer(a)
if (!Buffer.isBuffer(b)) b = new Buffer(b)
var res = []
if (a.length > b.length) {
for (var i = 0; i < b.length; i++) {
res.push(a[i] ^ b[i])
}
} else {
for (var i = 0; i < a.length; i++) {
res.push(a[i] ^ b[i])
}
}
return new Buffer(res);
};
module.exports = xor;