HmacAlgorithm extends SigningAlgorithm
Class HmacAlgorithm
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates signing algorithm based on HMAC.
- getHashAlgorithm() : string
- Return currently used hashing algorithm
- getSignature() : string
- Return message signature
- setHashAlgorithm() : $this
- Set hashing algorithm for using in HMAC
- verify() : bool
- Verify message signature
Methods
__construct()
Creates signing algorithm based on HMAC.
public
__construct([string|null $hashAlgorithm = null ]) : mixed
Parameters
- $hashAlgorithm : string|null = null
-
Hashing algorithm (optional). See registered algorithms in hash_algos().
Tags
getHashAlgorithm()
Return currently used hashing algorithm
public
getHashAlgorithm() : string
Return values
stringgetSignature()
Return message signature
public
getSignature(string $value, string $key) : string
Parameters
- $value : string
-
Message.
- $key : string
-
Secret password for HMAC.
Return values
stringsetHashAlgorithm()
Set hashing algorithm for using in HMAC
public
setHashAlgorithm(string $hashAlgorithm) : $this
Parameters
- $hashAlgorithm : string
-
Hashing algorithm. See registered algorithms in hash_algos().
Tags
Return values
$thisverify()
Verify message signature
public
verify(string $value, string $key, string $sig) : bool
Parameters
- $value : string
-
Message.
- $key : string
-
Secret password used while signing.
- $sig : string
-
Message signature password for HMAC.