You are here

public static function ParagonIE_Sodium_Crypto::auth in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Crypto.php \ParagonIE_Sodium_Crypto::auth()

HMAC-SHA-512-256 (a.k.a. the leftmost 256 bits of HMAC-SHA-512)

@internal Do not use this directly. Use ParagonIE_Sodium_Compat.

Parameters

string $message:

string $key:

Return value

string

Throws

TypeError

2 calls to ParagonIE_Sodium_Crypto::auth()
ParagonIE_Sodium_Compat::crypto_auth in vendor/paragonie/sodium_compat/src/Compat.php
Authenticate a message. Uses symmetric-key cryptography.
ParagonIE_Sodium_Crypto::auth_verify in vendor/paragonie/sodium_compat/src/Crypto.php
HMAC-SHA-512-256 validation. Constant-time via hash_equals().

File

vendor/paragonie/sodium_compat/src/Crypto.php, line 384

Class

ParagonIE_Sodium_Crypto
Class ParagonIE_Sodium_Crypto

Code

public static function auth($message, $key) {
  return ParagonIE_Sodium_Core_Util::substr(hash_hmac('sha512', $message, $key, true), 0, 32);
}