array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.sodium-compare.php', 1 => 'sodium_compare', ), 'up' => array ( 0 => 'ref.sodium.php', 1 => 'Sodium Functions', ), 'prev' => array ( 0 => 'function.sodium-bin2hex.php', 1 => 'sodium_bin2hex', ), 'next' => array ( 0 => 'function.sodium-crypto-aead-aes256gcm-decrypt.php', 1 => 'sodium_crypto_aead_aes256gcm_decrypt', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/sodium/functions/sodium-compare.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7 >= 7.2.0, PHP 8)
sodium_compare — Compare large numbers
Compare two strings as if they were arbitrary-length, unsigned little-endian integers, without side-channel leakage.
string1
Left operand
string2
Right operand
Returns -1
if string1
is less than string2
.
Returns 1
if string1
is greater than string2
.
Returns 0
if both strings are equal.