Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<sodium_crypto_auth_keygensodium_crypto_box>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026

sodium_crypto_auth_verify

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_auth_verify — Verifies that the tag is valid for the message

Description

function sodium_crypto_auth_verify(string $mac, string $message, #[\SensitiveParameter] string $key): bool

Verify the authentication tag is valid for a given message and key.

Unlike with digital signatures (e.g. sodium_crypto_sign_verify_detached()), any party capable of verifying a message is also capable of authenticating their own messages. (Hence, symmetric authentication.)

Parameters

mac

Authentication tag produced by sodium_crypto_auth()

message

Message

key

Authentication key

Return Values

Returns true on success or false on failure.


<sodium_crypto_auth_keygensodium_crypto_box>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026