Skip to content

Commit

Permalink
Do a better job at being randomer
Browse files Browse the repository at this point in the history
uniqid is not very random, and is deprecated.

https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_uniqid

re: #574
  • Loading branch information
dlangille committed Jun 30, 2024
1 parent 1b911f6 commit a26751d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function IsTaskAllowed($task) {
}

function createUserToken() {
$token = hash('sha256', uniqid(random_int(0, getrandmax()), true));
$token = bin2hex(random_bytes(32));
return $token;
}

Expand Down

0 comments on commit a26751d

Please sign in to comment.