From fac8ac1a68af9140f5ca458ffc18e56b904e597c Mon Sep 17 00:00:00 2001 From: oittaa <8972248+oittaa@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:18:38 +0100 Subject: [PATCH] UUIDv7 Draft 3 will simplify node generation (#39) --- src/UUID.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/UUID.php b/src/UUID.php index 0a1a6e8..73d54e2 100644 --- a/src/UUID.php +++ b/src/UUID.php @@ -217,10 +217,7 @@ public static function uuid7(): string $subsec = self::encodeSubsec($subsec); $uhex = substr(str_pad(dechex($unixts), 9, '0', \STR_PAD_LEFT), -9); $uhex .= substr_replace(str_pad(dechex($subsec), 6, '0', \STR_PAD_LEFT), '7', -3, 0); - do { - $node = random_bytes(8); - } while ($node === str_repeat(chr(0), 8)); - $uhex .= bin2hex($node); + $uhex .= bin2hex(random_bytes(8)); return self::uuidFromHex($uhex, 7); }