@me2em/crypto
    Preparing search index...

    Function bytesEqual

    • Constant-time comparison of two Uint8Arrays.

      Compares all bytes regardless of early mismatch to prevent timing attacks when checking secrets or authentication tags.

      Parameters

      • a: Uint8Array

        First byte array.

      • b: Uint8Array

        Second byte array.

      Returns boolean

      true if both arrays are identical in length and content.

      if (bytesEqual(expected, actual)) {
      // authenticated
      }