Node ID Generators#

Main interface: Arokettu\Uuid\Node\Node

Node generator classes represent different algorithms to generate the node field of the UUIDv1 and UUIDv6 as described in the RFC 4122. Node ID is a 48 bit long value, same as the MAC address.

Random Node#


Random node is a wrapper for a random generator, it will return a new byte sequence for every new UUID. This is the default node generator for the factory.

As described in the section 4.1.6 for non-MAC node IDs, the multicast bit will be set in the generated value.


use Arokettu\Uuid\Node\RandomNode;
use Arokettu\Uuid\UuidFactory;
use Random\Engine\PcgOneseq128XslRr64;
use Random\Randomizer;

// RNG can be overridden
$node = new RandomNode(new Randomizer(new PcgOneseq128XslRr64(111))); // generates d2f8f1d31aaa
$uuid = UuidFactory::v6($node); // ........-....-....-....-d3f8f1d31aaa
$uuid = UuidFactory::v6($node); // ........-....-....-....-bdcc9a006b19

Static Node#


Static node holds a constant value. It can be generated from any 6 byte value. This is the default generator for the sequences.



to generate a node ID from any 6 bytes


to generate a node ID from data in hex form (12 digits)


to generate a random node ID

Like a random node, static nodes have multicast bit set.

MAC Node#

New in version 2.2: MacNode::trySystem()


This is a node containing a MAC address (MAC-48/EUI-48). This was the default node algorithm proposed by the RFC 4122 but it is no longer recommended.



Parses a known MAC address. The factory accepts Unix-style MAC notation (12:34:56:78:90:ab), Windows-style MAC notation (12-34-56-78-90-ab), and a hex string without any separators (1234567890ab)


Tries to determine the system MAC address. This method works only on Linux and may be unreliable.


Tries to determine the system MAC address and returns null on failure. It can be used with a safe fallback:


$mac = MacNode::trySystem() ?? StaticNode::random();

Raw Node#


Like static node but without multicast bit validator. It is user’s responsibility to follow the standard with this type.


to generate a node ID from and 6 bytes


to generate a node ID from data in hex form (12 digits)