Function areUint8ArraysEqual

  • Compare two Uint8Arrays using a constant-time style loop to reduce timing side-channels when comparing sensitive data (e.g., mnemonic bytes, keys, authentication tags). Does not early-return on the first difference: work done depends only on the input lengths, so byte content does not affect timing.

    When to use:

    • Use for secret or security-sensitive byte comparisons to avoid content-based timing leaks.
    • Prefer when inputs are fixed-length (or validated to equal length) at the API boundary.

    Returns

    Whether the Uint8Arrays are equal.

    Parameters

    • a: Uint8Array

      The first Uint8Array to compare.

    • b: Uint8Array

      The second Uint8Array to compare.

    Returns boolean