You are here

public static function ParagonIE_Sodium_Crypto32::auth in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Crypto32.php \ParagonIE_Sodium_Crypto32::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_Crypto32::auth()
ParagonIE_Sodium_Compat::crypto_auth in vendor/paragonie/sodium_compat/src/Compat.php
Authenticate a message. Uses symmetric-key cryptography.
ParagonIE_Sodium_Crypto32::auth_verify in vendor/paragonie/sodium_compat/src/Crypto32.php
HMAC-SHA-512-256 validation. Constant-time via hash_equals().

File

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

Class

ParagonIE_Sodium_Crypto32
Class ParagonIE_Sodium_Crypto

Code

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