From e13a2628c5d10d6ea57560298782b0c23fe47ae6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 22 Aug 2024 08:47:36 -0500 Subject: [PATCH] Hash: umac's require a key; give a better error when one is missing --- phpseclib/Crypt/Hash.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpseclib/Crypt/Hash.php b/phpseclib/Crypt/Hash.php index 61aac867..4ad4cdd5 100644 --- a/phpseclib/Crypt/Hash.php +++ b/phpseclib/Crypt/Hash.php @@ -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';