Просмотр исходного кода

Make use of random_bytes for better uniqueness

Jordi Boggiano 9 лет назад
Родитель
Сommit
85792c8818
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/Monolog/Processor/UidProcessor.php

+ 1 - 1
src/Monolog/Processor/UidProcessor.php

@@ -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