mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
Hash: umac's require a key; give a better error when one is missing
This commit is contained in:
parent
6897b947ea
commit
e13a2628c5
@ -285,12 +285,16 @@ class Hash
|
|||||||
*/
|
*/
|
||||||
public function setHash($hash)
|
public function setHash($hash)
|
||||||
{
|
{
|
||||||
|
$oldHash = $this->hashParam;
|
||||||
$this->hashParam = $hash = strtolower($hash);
|
$this->hashParam = $hash = strtolower($hash);
|
||||||
switch ($hash) {
|
switch ($hash) {
|
||||||
case 'umac-32':
|
case 'umac-32':
|
||||||
case 'umac-64':
|
case 'umac-64':
|
||||||
case 'umac-96':
|
case 'umac-96':
|
||||||
case 'umac-128':
|
case 'umac-128':
|
||||||
|
if ($oldHash != $this->hashParam) {
|
||||||
|
$this->recomputeAESKey = true;
|
||||||
|
}
|
||||||
$this->blockSize = 128;
|
$this->blockSize = 128;
|
||||||
$this->length = abs(substr($hash, -3)) >> 3;
|
$this->length = abs(substr($hash, -3)) >> 3;
|
||||||
$this->algo = 'umac';
|
$this->algo = 'umac';
|
||||||
|
Loading…
Reference in New Issue
Block a user