Apply suggestions from code review
authorMarcel Werk <burntime@woltlab.com>
Wed, 1 Nov 2023 14:14:11 +0000 (15:14 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Nov 2023 14:14:11 +0000 (15:14 +0100)
Co-authored-by: Tim Düsterhus <duesterhus@woltlab.com>
wcfsetup/install/files/lib/system/user/authentication/password/algorithm/Pbkdf2.class.php

index 6f1fdbfe5c5cd455b9296343f0f7d114654f3caa..3784236d2efd83bd34fc20030119eb4fad1f826a 100644 (file)
@@ -29,7 +29,7 @@ final class Pbkdf2 implements IPasswordAlgorithm
         }
         [$hash, $salt, $algo, $iterations, $length] = $parts;
 
-        return \hash_equals($hash, \bin2hex(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true)));
+        return \hash_equals($hash, Hex::encode(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true)));
     }
 
     /**
@@ -43,7 +43,7 @@ final class Pbkdf2 implements IPasswordAlgorithm
         $algo = 'sha256';
         $iterations = 600000;
         $length = 32;
-        $hash = \bin2hex(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true));
+        $hash = Hex::encode(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true));
 
         return \implode(':', [$hash, $salt, $algo, $iterations, $length]);
     }