HashService implements SingletonInterface

FinalYes

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

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Methods

appendHmac()  : string
Appends a hash (HMAC) to a given string and additional secret and returns the result
hmac()  : string
Returns a proper HMAC with a length of 40 (HMAC-SHA-1) on a given input string, additional secret and the secret TYPO3 encryption key.
validateAndStripHmac()  : string
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.
validateHmac()  : bool
Returns, if a string $string and $additionalSecret matches the HMAC given by $hash.

Methods

appendHmac()

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

public appendHmac(string $string, non-empty-string $additionalSecret) : string
Parameters
$string : string
$additionalSecret : non-empty-string
Return values
string

hmac()

Returns a proper HMAC with a length of 40 (HMAC-SHA-1) on a given input string, additional secret and the secret TYPO3 encryption key.

public hmac(string $input, non-empty-string $additionalSecret) : string
Parameters
$input : string
$additionalSecret : non-empty-string
Return values
string

validateAndStripHmac()

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.

public validateAndStripHmac(non-empty-string $string, non-empty-string $additionalSecret) : string
Parameters
$string : non-empty-string
$additionalSecret : non-empty-string
Return values
string

validateHmac()

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

public validateHmac(string $string, non-empty-string $additionalSecret, string $hmac) : bool
Parameters
$string : string
$additionalSecret : non-empty-string
$hmac : string
Return values
bool

        
On this page

Search results