← All docs

hash_equals()

Compares two strings using a constant-time algorithm.

hash_equals()

function hash_equals(string $known_string, string $user_string): bool

Compares two strings using a constant-time algorithm.

Parameters:

  • $known_string (string)
  • $user_string (string)

Returns: bool

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how hash_equals is implemented in the compiler, see the internals page.