libuuid
uuid-generate
uuid-generate/  random
uuid-generate/  time
6.12

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)

"55a16042-9dc6-43a2-b0ec-43c06f9b3191"

> (uuid-generate)

"85bafc53-ed97-4902-ad3b-84b407dd7687"

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)

"6d7582ed-f121-4b86-8817-9842852f812c"

> (uuid-generate/random)

"7d6302cb-7532-4ab0-a6e4-4d7df2e7b913"

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)

"834156a6-03d3-11e8-bf95-080027c172e9"

> (uuid-generate/time)

"8341dfc2-03d3-11e8-bf95-080027c172e9"