Skip to main content
Compares two CallData instances for bytewise equality. Uses constant-time comparison to prevent timing attacks.

Signature

Parameters

  • a - First CallData instance
  • b - Second CallData instance

Returns

boolean - true if instances are bytewise identical, false otherwise

Examples

Constant-Time Comparison

Uses constant-time comparison to prevent timing attacks:
Why constant-time?
  • Prevents timing side-channel attacks
  • Attacker can’t learn where bytes differ
  • Standard practice for cryptographic comparisons
Note: Length check is not constant-time (not security-sensitive).

Use Cases

Transaction Matching

Replay Detection

Cache Management

Unit Testing

Performance

Constant-time comparison is fast:
Comparison time independent of where bytes differ.

Comparison Methods

Advantages:
  • Constant-time (secure)
  • No allocation
  • Fast
Use for:
  • Direct comparison
  • Security-sensitive code
  • Performance-critical paths

Edge Cases

Different lengths always return false (fast path).

Type Safety

Requires CallData instances (not plain Uint8Array):
  • hasSelector - Compare selectors only
  • is - Type guard check
  • toHex - Convert for string comparison
  • toBytes - Access raw bytes