A UUIDv7 implememt.
$ dotnet add package Aoxe.UUIDv7Aoxe.UUIDv7 is a C# library for generating UUID version 7 identifiers based on the proposed RFC. It provides time-ordered UUIDs with improved sorting and uniqueness features.
Install via NuGet Package Manager:
dotnet add package Aoxe.UUIDv7
Or via the Package Manager Console:
Install-Package Aoxe.UUIDv7
using Aoxe.UUIDv7;
class Program
{
static void Main()
{
// Generate a UUIDv7
Guid uuid = Uuid7Generator.GenerateUuid7();
// Convert to a 25-character Base32 string
string id25 = uuid.ToId25();
// Convert to a 22-character Base64URL string
string id22 = uuid.ToId22();
Console.WriteLine($"UUIDv7: {uuid}");
Console.WriteLine($"ID25: {id25}");
Console.WriteLine($"ID22: {id22}");
}
}
Uuid7Generator.GenerateUuid7()Generates a new UUID version 7.
Uuid7Generator.ToId25(this Guid uuid)Converts a UUID to a 25-character Base32 encoded string.
Uuid7Generator.ToId22(this Guid uuid)Converts a UUID to a 22-character Base64URL encoded string.
Contributions are welcome. Please submit issues and pull requests for any improvements.
This project is licensed under the MIT License.