public static function ParagonIE_Sodium_Compat::crypto_auth_verify in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_auth_verify()
Verify the MAC of a message previously authenticated with crypto_auth.
@psalm-suppress MixedArgument
Parameters
string $mac Message authentication code:
string $message Message whose authenticity you are attempting to: verify (with a given MAC and key)
string $key Symmetric authentication key:
Return value
bool TRUE if authenticated, FALSE otherwise
Throws
SodiumException
TypeError
2 calls to ParagonIE_Sodium_Compat::crypto_auth_verify()
- php72compat.php in vendor/
paragonie/ sodium_compat/ lib/ php72compat.php - sodium_compat.php in vendor/
paragonie/ sodium_compat/ lib/ sodium_compat.php
File
- vendor/
paragonie/ sodium_compat/ src/ Compat.php, line 1001
Class
Code
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);
}