talira

uuid (Erlang)

Erlang native UUID generation

open sourceMITfree

uuid is Michael Truog's Erlang library for generating UUIDs as RFC 9562 defines them: version 1 (with the Erlang pid and node name folded into the node ID), versions 3 (MD5), 4 (random) and 5 (SHA), and the newer versions 6 (ordered), 7 (Unix epoch) and 8 (custom). It's published on Hex as uuid_erl and takes its randomness from the quickrand library.

Problems it solves

  • generate time-ordered UUIDv7 ids in my Erlang or Elixir service
  • create random UUIDs quickly in Erlang
  • make UUIDs that show which Erlang node and process created them
  • generate name-based UUIDs from a namespace in Erlang

Features

  • UUID versions 1, 3, 4, 5, 6, 7 and 8
  • version 1 UUIDs carrying the Erlang pid and node name
  • cached random data for fast version 4 UUIDs

Limitations

  • Some functions need quickrand seeded or its cache initialised in the calling process first1

Alternatives

The same job

These do what uuid (Erlang) does.

  1. Uniq UUID generation, parsing and formatting for Elixir
  2. Nanoid (Elixir) Elixir port of Nano ID, a tiny, secure, URL-friendly unique ID generator

Compare uuid (Erlang) with the top 3