array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.sodium-crypto-auth.php', 1 => 'sodium_crypto_auth', 2 => 'Compute a tag for the message', ), 'up' => array ( 0 => 'ref.sodium.php', 1 => 'Sodium 函数', ), 'prev' => array ( 0 => 'function.sodium-crypto-aead-xchacha20poly1305-ietf-keygen.php', 1 => 'sodium_crypto_aead_xchacha20poly1305_ietf_keygen', ), 'next' => array ( 0 => 'function.sodium-crypto-auth-keygen.php', 1 => 'sodium_crypto_auth_keygen', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/sodium/functions/sodium-crypto-auth.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

sodium_crypto_auth

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_authCompute a tag for the message

说明

sodium_crypto_auth(string $message, #[\SensitiveParameter] string $key): string

Symmetric message authentication via sodium_crypto_auth() provides integrity, but not confidentiality.

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

参数

message

The message you intend to authenticate

key

Authentication key

返回值

Authentication tag