rrchelbi/uuiz
Because every identity deserves a unique one. 🆔
uuiz - Because every identity deserves a unique one. 🆔
A lightweight, zero-dependency UUID library for Zig. Provides RFC 4122 compliant UUID generation, parsing, and manipulation with a focus on performance and type safety.
$ zig fetch --save git+https://www.github.com/rrchelbi/uuiz#main
After this your build.zig.zon
should look like this:
.{
// other attributes
// ...
.dependencies = .{
// other dependencies
// ...
.uuiz = .{
.url = "https://github.com/rrchelbi/uuiz?ref=main#...",
.hash = "1220...",
},
},
}
build.zig
:const uuiz = b.dependency("uuiz", .{
.target = target,
.optimize = optimize,
});
exe.addModule("uuiz", uuiz.module("uuiz"));
const std = @import("std");
const uuiz = @import("uuiz");
pub fn main() !void {
const uuid = uuiz.v4.new();
std.debug.print("Generated v4 UUID: {}\n", .{uuid});
}
// Main UUID type (128 bits)
const UUID = u128;
// UUID versions
const Version = enum {
v1, // Time-based
v2, // DCE Security
v3, // MD5 hash
v4, // Random
v5, // SHA-1 hash
v6, // Ordered time-based
v7, // Unix timestamp-based
v8, // Custom
};
Version | Status | Description |
---|---|---|
v1 | ✅ | Time-based |
v2 | DCE Security | |
v3 | MD5 namespace-based | |
v4 | ✅ | Random (cryptographically secure) |
v5 | SHA-1 namespace-based | |
v6 | Ordered time-based | |
v7 | Unix timestamp-based | |
v8 | Custom format |
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.