Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silversquirl/zig-uuid
UUIDs for Zig
https://github.com/silversquirl/zig-uuid
Last synced: 22 days ago
JSON representation
UUIDs for Zig
- Host: GitHub
- URL: https://github.com/silversquirl/zig-uuid
- Owner: silversquirl
- License: unlicense
- Created: 2021-03-05T02:48:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T20:00:01.000Z (8 months ago)
- Last Synced: 2024-03-05T21:22:30.819Z (8 months ago)
- Language: Zig
- Size: 13.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zig-uuid
UUID library for Zig. Currently supports UUID versions 3, 4 and 5.
## Examples
```zig
// Parse a string UUID (can be with or without dashes)
try uuid.Uuid.fromString("00112233-4455-6677-8899-aabbccddeeff")// Generate a random UUID and format it as a string
uuid.Uuid.v4().toStringCompact();
uuid.Uuid.v4().toStringWithDashes();// Get the raw bytes of a generated SHA-1 UUID with zero namespace
uuid.Uuid.v5(&uuid.Uuid.zero.bytes, "Hello, world!").bytes;// Generate an MD5 UUID with custom namespace and convert it to a u128
uuid.Uuid.v3(&namespace.bytes, "foobar").toInt();
```