fynydd.duid 1.0.5

dotnet add package fynydd.duid --version 1.0.5
                    
NuGet\Install-Package fynydd.duid -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="fynydd.duid" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="fynydd.duid" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="fynydd.duid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add fynydd.duid --version 1.0.5
                    
#r "nuget: fynydd.duid, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package fynydd.duid@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=fynydd.duid&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=fynydd.duid&version=1.0.5
                    
Install as a Cake Tool

DUID: The high entropy, web-friendly, globally unique identifier

DUID is a fully-featured replacement for GUIDs (Globally Unique Identifiers). They are more compact, web-friendly, and provide more entropy than GUIDs. We created this UUID type as a replacement for GUIDs in our projects, improving on several GUID shortcomings.

We pronounce it doo-id, but it can also be pronounced like dude, which is by design 😃

Key security features:

  • Uses the latest .NET cryptographic random number generator
  • More entropy than GUID v4 (128 bits vs 122 bits)
  • No embedded timestamp (reduces predictability and improves strength)
  • Self-contained; does not use any packages

Usage features:

  • High performance, with minimal allocations
  • 16 bytes in size; 22 characters as a string
  • Always starts with a letter (can be used as-is for programming language variable names)
  • URL-safe
  • Can be validated, parsed, and compared
  • Can be created from and converted to byte arrays
  • UTF-8 encoding support
  • JSON serialization support
  • TypeConverter support
  • Debug support (displays as string in debugger)

Nuget

Yes, you can also find DUID on nuget. Look for the package named fynydd.duid.

Usage

Similar to Guid.NewGuid(), you can generate a new DUID by calling the static NewDuid method:

var duid = Duid.NewDuid();

This will produce a new DUID, for example: aZ3x9Kf8LmN2QvW1YbXcDe.

There are a ton of overloads and extension methods for converting, validating, parsing, and comparing DUIDs. Here are some examples:

// Represents an empty DUID (all zeros); "AAAAAAAAAAAAAAAAAAAAAA"
var emptyDuid = Duid.Empty;

// Get a string value for a DUID
var duid = Duid.NewDuid();
var duidString = duid.ToString();

if (Duid.TryParse("aZ3x9Kf8LmN2QvW1YbXcDe", out var duid)
{
    // Successfully parsed DUID
}

if (Duid.IsValidString("aZ3x9Kf8LmN2QvW1YbXcDe"))
{
    // Successfully validated
}

if (duid1 == duid2)
{
    // Comparison works as expected
}

There is also a JSON converter for System.Text.Json that provides seamless serialization and deserialization of DUIDs:

var options = new JsonSerializerOptions();
options.Converters.Add(new DuidJsonConverter());

var user = new User
{
    Id = Duid.NewDuid(),
    FirstName = "Turd",
    LastName = "Ferguson"
};

var json = JsonSerializer.Serialize(user, options);

/*
    json =
    {
        id: "xw5x7Kf6LmN3QvW1YbXcc0",
        firstName: "Turd",
        lastName: "Ferguson"
    }
*/

This scratches the surface of what's available. Try using DUIDs in your project to explore all the features it provides.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 108 1/27/2026
1.0.4 436 12/8/2025

Added Duid.IsNullOrEmpty()