8.6
libuuid
Jan Dvorak <mordae@anilinux.org>
Interface to the libuuid library usable to generate high-quality UUIDs.
(require libuuid) | package: libuuid |
procedure
(uuid-generate) → string?
Generate new universally unique identifier using /dev/urandom,
if available. If it is not available, use current time, local ethernet
MAC address and random data from a pseudo-random generator.
Examples:
> (uuid-generate) "95fed083-4983-4891-933f-3497b375"
> (uuid-generate) "a7b2fa97-d030-40ef-a9d2-83cfdc7f"
procedure
When /dev/urandom is available, same as uuid-generate,
but fails back to a pseudo-random generator only.
Can be used to prevent any chance of host’s MAC address leaking, at the cost of slightly higher chance of generating non-unique identifiers if the worst-case situation arises on multiple hosts.
Examples:
> (uuid-generate/random) "65c8d37f-2ae8-4b80-b19f-f83b495a"
> (uuid-generate/random) "9641fbb3-1101-4d42-9d72-78bb2d50"
procedure
Same as uuid-generate when the /dev/urandom is missing.
Could potentially produce non-uniqueue identifiers if used concurrently so if you do not absolutely need sequential identifiers, stick with the generic (and safe) uuid-generate function above.
Examples:
> (uuid-generate/time) "4ceaf02a-16c1-11ed-95da-d7654557"
> (uuid-generate/time) "4ceb0704-16c1-11ed-95da-d7654557"