Skip to content

Commit 6c3e22c

Browse files
committed
remove usage of md5
1 parent 096986a commit 6c3e22c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/User.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private static function generateTokenCode() {
1313
}
1414

1515
private static function generateTokenHex() {
16-
return md5(random_bytes(32));
16+
return bin2hex(random_bytes(16));
1717
}
1818

1919
private static function generateExpiresTimestamp($lifetime) {
@@ -89,9 +89,9 @@ public static function createUser($newUser) {
8989
if (!self::validatePasswordStrength($newUser['password'])) {
9090
return false;
9191
}
92-
$generatedUserId = md5(random_bytes(32));
92+
$generatedUserId = bin2hex(random_bytes(16));
9393
while (self::userIdExists($generatedUserId)) {
94-
$generatedUserId = md5(random_bytes(32));
94+
$generatedUserId = bin2hex(random_bytes(16));
9595
}
9696
$query = Db::$pdo->prepare(
9797
'INSERT INTO users VALUES (:userId, :email, :passwordHash, :data)'

0 commit comments

Comments
 (0)