Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alex-ber/AlexBerUtils/llms.txt

Use this file to discover all available pages before exploring further.

The uuids module provides uuid1mc, a UUID generator that combines the timestamp component of UUID version 1 with a randomly generated broadcast MAC address rather than the actual hardware MAC. This avoids exposing network topology while retaining the time-ordered properties of v1 UUIDs.

uuid1mc

Generates a version 1 UUID with a random broadcast MAC address.
from alexber.utils import uuid1mc

uid = uuid1mc()
print(uid)  # e.g. 550e8400-e29b-41d4-a716-446655440000
Returns: uuid.UUID — a v1 UUID with a randomly generated broadcast MAC node.

Why not uuid.uuid1() or uuid.uuid4()?

Propertyuuid1()uuid4()uuid1mc()
Time-orderedYesNoYes
Host-specificYes (real MAC)NoNo (random MAC)
Collision resistance~2^60 bits~2^122 bits~2^121 bits
Exposes network infoYesNoNo
uuid1mc is the recommended choice when you want time-based ordering without exposing the host’s MAC address. It provides approximately 121 bits of uniqueness (60 bits of time + 61 random bits), very close to uuid4()’s 122 random bits.
Some environments (notably certain Amazon EC2 instances) have been reported to produce UUID v1 collisions at high generation rates. If you generate more than ~100k UUIDs within a short window and require strict uniqueness, consider uuid.uuid4() instead.

How it works

A regular uuid.uuid1() call embeds the real hardware MAC address in the node field. uuid1mc() replaces this with a cryptographically random 48-bit value with the multicast bit set (0x010000000000), as permitted by the RFC 4122 specification. The time component is still derived from the current system clock.

Build docs developers (and LLMs) love