mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Fixed a couple of spots where random values were not using cryptographically-secure methods.
This commit is contained in:
parent
ee6a196a72
commit
14bed9c570
@ -250,7 +250,7 @@ final class session {
|
||||
* @return string The generated session key.
|
||||
*/
|
||||
private function generate_session_key() {
|
||||
return strtolower(sha1(uniqid(mt_rand(), true)));
|
||||
return bin2hex(random_bytes(20));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,8 +55,8 @@ class user extends cora\crud {
|
||||
* without having to spend the time creating an actual user.
|
||||
*/
|
||||
public function create_anonymous_user() {
|
||||
$username = strtolower(sha1(uniqid(mt_rand(), true)));
|
||||
$password = strtolower(sha1(uniqid(mt_rand(), true)));
|
||||
$username = bin2hex(random_bytes(20));
|
||||
$password = bin2hex(random_bytes(20));
|
||||
$user = $this->create([
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
|
Loading…
x
Reference in New Issue
Block a user