UNPKG

edge-core-js

Version:

Edge account & wallet management library

13 lines (11 loc) 291 B
/** * Compares two byte arrays without data-dependent branches. * Returns true if they match. */ export function verifyData(a, b) { const length = a.length if (length !== b.length) return false let out = 0 for (let i = 0; i < length; ++i) out |= a[i] ^ b[i] return out === 0 }