argentini.duid 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package argentini.duid --version 1.0.1
                    
NuGet\Install-Package argentini.duid -Version 1.0.1
                    
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="argentini.duid" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="argentini.duid" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="argentini.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 argentini.duid --version 1.0.1
                    
#r "nuget: argentini.duid, 1.0.1"
                    
#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 argentini.duid@1.0.1
                    
#: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=argentini.duid&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=argentini.duid&version=1.0.1
                    
Install as a Cake Tool

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

DUID is a replacement for GUIDs (Globally Unique Identifiers) that are more compact, URL-safe, and JavaScript entity name-safe. DUIDs are 22-character alphanumeric codes that always begin with a letter. Unlike GUID v4 there is no version code which means more entropy. They have no timestamp information, so they are not sortable (which also improves strength by eliminating predictability).

Under the hood, DUIDs are generated using the latest .NET cryptographic random number generator.

You can also find DUID on nuget.

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:

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

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 duid = Duid.NewDuid();
var json = JsonSerializer.Serialize(duid, options);

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 was computed.  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.
  • 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 136 1/27/2026
1.0.4 227 11/26/2025
1.0.3 318 11/12/2025
1.0.2 317 11/12/2025
1.0.1 317 11/11/2025

Initial release