libuuid
uuid-generate
uuid-generate/  random
uuid-generate/  time
7.7

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)

"87de1456-1022-48bb-8090-e7b7e530b4f0"

> (uuid-generate)

"653992da-3009-4bd9-a2a2-af4b11a08dd4"

procedure

(uuid-generate/random)  string?

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)

"268ed4cd-7675-464e-93f9-a6cc0e4f50f6"

> (uuid-generate/random)

"364c1dd0-b500-41c4-bcb5-0eec8dc0f103"

procedure

(uuid-generate/time)  string?

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)

"eb569f90-8d0f-11ea-84e5-c16db3d41a5f"

> (uuid-generate/time)

"eb56abe8-8d0f-11ea-84e5-c16db3d41a5f"