1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 20:57:36 +02:00

Make use of random_bytes for better uniqueness

This commit is contained in:
Jordi Boggiano
2016-09-25 21:23:55 +02:00
parent 6e6586257d
commit 85792c8818

View File

@@ -26,7 +26,7 @@ class UidProcessor
throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
}
$this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
$this->uid = substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length);
}
public function __invoke(array $record): array