‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Crypto\HashService Class Reference
Inheritance diagram for TYPO3\CMS\Core\Crypto\HashService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 hmac (string $input, string $additionalSecret)
 
 appendHmac (string $string, string $additionalSecret)
 
 validateHmac (string $string, string $additionalSecret, string $hmac)
 
 validateAndStripHmac (string $string, string $additionalSecret)
 

Detailed Description

A hash service to generate and validate SHA-1 hashes.

Definition at line 26 of file HashService.php.

Member Function Documentation

◆ appendHmac()

TYPO3\CMS\Core\Crypto\HashService::appendHmac ( string  $string,
string  $additionalSecret 
)

Appends a hash (HMAC) to a given string and additional secret and returns the result

Parameters
non-empty-string$additionalSecret

Definition at line 49 of file HashService.php.

References TYPO3\CMS\Core\Crypto\HashService\hmac().

◆ hmac()

TYPO3\CMS\Core\Crypto\HashService::hmac ( string  $input,
string  $additionalSecret 
)

◆ validateAndStripHmac()

TYPO3\CMS\Core\Crypto\HashService::validateAndStripHmac ( string  $string,
string  $additionalSecret 
)

Tests if the last 40 characters of a given string $string and $additionalSecret matches the HMAC of the rest of the string and, if true, returns the string without the HMAC. In case of an invalid HMAC string an exception is thrown.

Parameters
non-empty-string$string
non-empty-string$additionalSecret

Definition at line 72 of file HashService.php.

References TYPO3\CMS\Core\Crypto\HashService\validateHmac().

◆ validateHmac()

TYPO3\CMS\Core\Crypto\HashService::validateHmac ( string  $string,
string  $additionalSecret,
string  $hmac 
)

Returns, if a string $string and $additionalSecret matches the HMAC given by $hash.

Parameters
non-empty-string$additionalSecret

Definition at line 59 of file HashService.php.

References TYPO3\CMS\Core\Crypto\HashService\hmac().

Referenced by TYPO3\CMS\Core\Crypto\HashService\validateAndStripHmac().