Hash: umac's require a key; give a better error when one is missing

This commit is contained in:
terrafrost 2024-08-22 08:47:36 -05:00
parent 6897b947ea
commit e13a2628c5

View File

@ -285,12 +285,16 @@ class Hash
*/
public function setHash($hash)
{
$oldHash = $this->hashParam;
$this->hashParam = $hash = strtolower($hash);
switch ($hash) {
case 'umac-32':
case 'umac-64':
case 'umac-96':
case 'umac-128':
if ($oldHash != $this->hashParam) {
$this->recomputeAESKey = true;
}
$this->blockSize = 128;
$this->length = abs(substr($hash, -3)) >> 3;
$this->algo = 'umac';