Support generation of version 2 (DCE Security) UUIDs

This commit is contained in:
Ben Ramsey
2020-01-18 12:12:01 -06:00
parent b52fff6b52
commit 72a2312f62
19 changed files with 1314 additions and 26 deletions
+25
View File
@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Ramsey\Uuid;
use Ramsey\Uuid\Type\Hexadecimal;
use Ramsey\Uuid\Type\IntegerValue;
use Ramsey\Uuid\Validator\ValidatorInterface;
/**
@@ -44,6 +46,29 @@ interface UuidFactoryInterface
*/
public function uuid1($node = null, ?int $clockSeq = null): UuidInterface;
/**
* Returns a version 2 (DCE Security) UUID from a local domain, local
* identifier, host ID, clock sequence, and the current time
*
* @param int $localDomain The local domain to use when generating bytes,
* according to DCE Security
* @param IntegerValue|null $localIdentifier The local identifier for the
* given domain; this may be a UID or GID on POSIX systems, if the local
* domain is person or group, or it may be a site-defined identifier
* if the local domain is org
* @param Hexadecimal|null $node A 48-bit number representing the hardware
* address
* @param int|null $clockSeq A 14-bit number used to help avoid duplicates
* that could arise when the clock is set backwards in time or if the
* node ID changes
*/
public function uuid2(
int $localDomain,
?IntegerValue $localIdentifier,
?Hexadecimal $node = null,
?int $clockSeq = null
): UuidInterface;
/**
* Returns a version 3 (name-based) UUID based on the MD5 hash of a
* namespace ID and a name