Skip to content

Commit

Permalink
Fix random bytes having null terminators
Browse files Browse the repository at this point in the history
  • Loading branch information
tchapi committed Aug 30, 2024
1 parent da31900 commit c4faa17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Services/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function createPasswordlessUserWithDefaultObjects(string $username, strin
$user->setUsername($username);

// Set the password to a random string (but hashed beforehand)
$randomBytes = random_bytes(256);
$randomBytes = substr(bin2hex(random_bytes(256)), 0, 48);
$hash = password_hash($randomBytes, PASSWORD_DEFAULT);
$user->setPassword($hash);

Expand Down

0 comments on commit c4faa17

Please sign in to comment.