GenericHash
in package
Class GenericHash.
Table of Contents
- $hashLength : int
- $key : string
- __construct() : mixed
- GenericHash constructor.
- makeKey() : string
- Makes a key.
- signature() : string
- Gets a message signature.
- verify() : bool
- Verifies if a message matches a signature.
- makeHash() : string
- Makes a hash to a message.
- validateHashLength() : void
- Validates a hash length.
- validateKey() : void
- Validates a key.
Properties
$hashLength
protected
int
$hashLength
= \SODIUM_CRYPTO_GENERICHASH_BYTES
$key
protected
string
$key
Methods
__construct()
GenericHash constructor.
public
__construct(string $key[, int $hashLength = SODIUM_CRYPTO_GENERICHASH_BYTES ]) : mixed
Parameters
- $key : string
- $hashLength : int = SODIUM_CRYPTO_GENERICHASH_BYTES
Tags
Return values
mixed —makeKey()
Makes a key.
public
static makeKey() : string
Return values
string —signature()
Gets a message signature.
public
signature(string $message[, int|null $hashLength = null ]) : string
Parameters
- $message : string
- $hashLength : int|null = null
-
A custom hash length or null to use the length set in the constructor
Tags
Return values
string —verify()
Verifies if a message matches a signature.
public
verify(string $message, string $signature[, int|null $hashLength = null ]) : bool
Parameters
- $message : string
- $signature : string
- $hashLength : int|null = null
-
A custom hash length or null to use the length set in the constructor
Tags
Return values
bool —makeHash()
Makes a hash to a message.
protected
makeHash(string $message[, int|null $length = null ]) : string
Parameters
- $message : string
- $length : int|null = null
-
A custom length or null to use the length set in the constructor
Tags
Return values
string —validateHashLength()
Validates a hash length.
protected
validateHashLength(int $length) : void
Parameters
- $length : int
Tags
Return values
void —validateKey()
Validates a key.
protected
validateKey(string $key) : void
Parameters
- $key : string