From 51673118bbd6d9baff464517ebfecdb53abc83e3 Mon Sep 17 00:00:00 2001 From: benchea dan <30780133+bnchdan@users.noreply.github.com> Date: Wed, 9 Feb 2022 10:39:15 +0200 Subject: [PATCH] Update PFACrypt.php if you have old hashes like $nr$salt$hash and you migrate to {algoithm}hash --- model/PFACrypt.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/model/PFACrypt.php b/model/PFACrypt.php index 726ab874..6aa167fc 100644 --- a/model/PFACrypt.php +++ b/model/PFACrypt.php @@ -60,6 +60,17 @@ class PFACrypt $algorithm = $method_in_hash; } } + + if (!empty($pw_db) && preg_match('/^\$[0-9]\$/i', $pw_db, $matches)) { + $method_in_hash = $matches[0]; + switch ($method_in_hash){ + case '$1$': + case '$6$': + $algorithm='SYSTEM'; + } + } + + if ($algorithm == 'SHA512CRYPT.B64') { $algorithm = 'SHA512-CRYPT.B64'; }