libuuid
uuid-generate
uuid-generate/  random
uuid-generate/  time
7.3

libuuid

Jan Dvorak <[email protected]>

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)

"9315824e-0eba-4d9f-9179-2d0ee2960d5d"

> (uuid-generate)

"b7144f0c-42fe-4450-8f4d-60c0f77005b1"

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)

"d937fbce-5311-45c8-9cf9-d47b8c22467f"

> (uuid-generate/random)

"61e129ad-e091-47d9-ae6f-24effc0deeb5"

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)

"c44f8a5a-7844-11e9-af94-8d4501046f5a"

> (uuid-generate/time)

"c44f97fc-7844-11e9-af94-8d4501046f5a"