Something went wrong. Try again.
A Zig library for generating, parsing, and formatting RFC 9562 UUIDs.
Something went wrong. Try again.
<!-- SPDX-FileCopyrightText: © 2025 Jeffrey C. Ollie -->
<!-- SPDX-License-Identifier: MIT -->
# RFC 9562 UUIDs for Zig
A Zig library for generating, parsing, and formatting
[RFC 9562](https://www.rfc-editor.org/rfc/rfc9562.html) UUIDs.
The API documentation, generated from the doc comments in the source,
is published at <https://jeff.jcollie.page/zig-uuid/>.
## Features
- Generate version 1, 2, 3, 4, 5, 6, 7, and 8 UUIDs
- The special `nil` (all zeros) and `max` (all ones) UUIDs
- The well-known name space IDs (DNS, URL, OID, X.500) for creating
v3 and v5 UUIDs
- Create v3 and v5 UUIDs straight from a name space and a name with
`UUID.fromName`, which does the hashing; the name can be given in parts
- Parse and format the standard string representation
(`c232ab00-9414-11ec-b3c8-9f6bdeced846`) and the URN representation
(`urn:uuid:c232ab00-9414-11ec-b3c8-9f6bdeced846`)
- Parse and format the Windows registry form of a GUID — upper case, in
braces (`{C232AB00-9414-11EC-B3C8-9F6BDECED846}`) — as Windows
Installer and WiX use it; the hex case and the braces can also be
chosen separately
- Implements `format` so UUIDs can be printed directly with `{f}`, and
`fmt` to print them in any of the other forms
- `UUID` is a packed union that is exactly 128 bits — compare UUIDs
with `a.id == b.id`, or access the version and variant fields via
`meta`
- No allocations, no dependencies
## Source
The canonical repository is <https://git.jcollie.dev/jeff/zig-uuid>:
```sh
git clone https://git.jcollie.dev/jeff/zig-uuid.git
```
It is also on the Radicle network, where the repository's identifier is
```
rad:z3uZSgLiCAhT3BkqgaaoF1SKvye6s
```
and `rad clone rad:z3uZSgLiCAhT3BkqgaaoF1SKvye6s` fetches it from any
node that seeds it, needing no account and no forge. A further copy is
mirrored to <https://tangled.org/jcollie.dev/zig-uuid>. All three carry
the same history on `main`; the Forgejo one is where the tests and the
documentation build run.
## Requirements
Zig 0.17.0. The development shell takes the…