sodium_memcmp
sodium_memcmp
Test for equality in constant-time
int **sodium_memcmp** string $string1 string $string2
Compare two strings in constant-time.
In practice, you almost always want to use instead,
since it provides the same logic but returns a instead of an
. However, if you're using the return value of a comparison in a
calculation that's timing-sensitive, and worried about timing leaks with bool-to-int
conversions, is an ideal replacement.
hash_equals``bool``int``sodium_memcmp
string1String to compare
string2Other string to compare
Returns if both strings are equal; otherwise.
0``-1