WordPress at Your Fingertips
function is not described

ParagonIE_Sodium_Compat::crypto_auth_verify() public WP 1.0

Verify the MAC of a message previously authenticated with crypto_auth.

{} It's a method of the class: ParagonIE_Sodium_Compat{}

No Hooks.


true|false. TRUE if authenticated, FALSE otherwise


$result = ParagonIE_Sodium_Compat::crypto_auth_verify( $mac, $message, $key );
$mac(string) (required)
Message authentication code
$message(string) (required)
Message whose authenticity you are attempting to verify (with a given MAC and key)
$key(string) (required)
Symmetric authentication key

Code of ParagonIE_Sodium_Compat::crypto_auth_verify() WP 5.9

public static function crypto_auth_verify($mac, $message, $key)
    /* Type checks: */
    ParagonIE_Sodium_Core_Util::declareScalarType($mac, 'string', 1);
    ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 2);
    ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 3);

    /* Input validation: */
    if (ParagonIE_Sodium_Core_Util::strlen($mac) !== self::CRYPTO_AUTH_BYTES) {
        throw new SodiumException('Argument 1 must be CRYPTO_AUTH_BYTES long.');
    if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_AUTH_KEYBYTES) {
        throw new SodiumException('Argument 3 must be CRYPTO_AUTH_KEYBYTES long.');

    if (self::useNewSodiumAPI()) {
        return (bool) sodium_crypto_auth_verify($mac, $message, $key);
    if (self::use_fallback('crypto_auth_verify')) {
        return (bool) call_user_func('\\Sodium\\crypto_auth_verify', $mac, $message, $key);
    if (PHP_INT_SIZE === 4) {
        return ParagonIE_Sodium_Crypto32::auth_verify($mac, $message, $key);
    return ParagonIE_Sodium_Crypto::auth_verify($mac, $message, $key);