ParagonIE_Sodium_Compat::crypto_auth()public staticWP 1.0

Authenticate a message. Uses symmetric-key cryptography.


HMAC-SHA512-256. Which is HMAC-SHA-512 truncated to 256 bits.
Not to be confused with HMAC-SHA-512/256 which would use the
SHA-512/256 hash function (uses different initial parameters
but still truncates to 256 bits to sidestep length-extension

{} Это метод класса: ParagonIE_Sodium_Compat{}

Хуков нет.


Строку. Message authentication code


$result = ParagonIE_Sodium_Compat::crypto_auth( $message, $key );
$message(строка) (обязательный)
Message to be authenticated
$key(строка) (обязательный)
Symmetric authentication key

Код ParagonIE_Sodium_Compat::crypto_auth() WP 6.0.2

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

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

    if (self::useNewSodiumAPI()) {
        return (string) sodium_crypto_auth($message, $key);
    if (self::use_fallback('crypto_auth')) {
        return (string) call_user_func('\\Sodium\\crypto_auth', $message, $key);
    if (PHP_INT_SIZE === 4) {
        return ParagonIE_Sodium_Crypto32::auth($message, $key);
    return ParagonIE_Sodium_Crypto::auth($message, $key);