Hash
class Hash (View source)
Constants
PADDING_SHA3 |
Padding Types |
PADDING_SHAKE |
Padding Types |
Methods
Default Constructor.
Sets the key for HMACs
Sets the nonce for UMACs
Gets the hash function.
Sets the hash function.
Compute the Hash / HMAC / UMAC.
Returns the hash length (in bits)
Returns the hash length (in bytes)
Returns the block length (in bits)
Returns the block length (in bytes)
__toString() magic method
Details
__construct(string $hash = 'sha256')
Default Constructor.
setKey(string $key = false)
Sets the key for HMACs
Keys can be of any length.
setNonce(string $nonce = false)
Sets the nonce for UMACs
Keys can be of any length.
string
getHash()
Gets the hash function.
As set by the constructor or by the setHash() method.
setHash(string $hash)
Sets the hash function.
string
hash(string $text)
Compute the Hash / HMAC / UMAC.
int
getLength()
Returns the hash length (in bits)
int
getLengthInBytes()
Returns the hash length (in bytes)
int
getBlockLength()
Returns the block length (in bits)
int
getBlockLengthInBytes()
Returns the block length (in bytes)
__toString()
__toString() magic method