Skip to content

Commit 3f576ed

Browse files
committed
changed openssl to random_bytes generator
1 parent 8f966b7 commit 3f576ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Traits/HasNameTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use function bin2hex;
66
use function ceil;
77
use function openssl_random_pseudo_bytes;
8+
use function random_bytes;
89
use function substr;
910

1011
trait HasNameTrait
@@ -45,7 +46,7 @@ private function generateName(string $prefix = 'var', int $length = null): strin
4546
{
4647
$length ??= self::$automaticVariableLength;
4748

48-
return $prefix . substr(bin2hex(openssl_random_pseudo_bytes(ceil($length / 2))), 0, $length);
49+
return $prefix . substr(bin2hex(random_bytes($length)), 0, $length);
4950
}
5051

5152
private function configureName(?string $givenName, string $prefix, int $length = null): void

0 commit comments

Comments
 (0)