/opt/canhelp/node_modules/better-auth/dist/crypto
Edit: /opt/canhelp/node_modules/better-auth/dist/crypto/buffer.mjs (623B)
//#region src/crypto/buffer.ts
/**
* Compare two buffers in constant time.
*/
function constantTimeEqual(a, b) {
if (typeof a === "string") a = new TextEncoder().encode(a);
if (typeof b === "string") b = new TextEncoder().encode(b);
const aBuffer = new Uint8Array(a);
const bBuffer = new Uint8Array(b);
let c = aBuffer.length ^ bBuffer.length;
const length = Math.max(aBuffer.length, bBuffer.length);
for (let i = 0; i < length; i++) c |= (i < aBuffer.length ? aBuffer[i] : 0) ^ (i < bBuffer.length ? bBuffer[i] : 0);
return c === 0;
}
//#endregion
export { constantTimeEqual };
//# sourceMappingURL=buffer.mjs.map