XstarS.GuidGenerators 1.3.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package XstarS.GuidGenerators --version 1.3.1                
NuGet\Install-Package XstarS.GuidGenerators -Version 1.3.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="XstarS.GuidGenerators" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XstarS.GuidGenerators --version 1.3.1                
#r "nuget: XstarS.GuidGenerators, 1.3.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.
// Install XstarS.GuidGenerators as a Cake Addin
#addin nuget:?package=XstarS.GuidGenerators&version=1.3.1

// Install XstarS.GuidGenerators as a Cake Tool
#tool nuget:?package=XstarS.GuidGenerators&version=1.3.1                

.NET GUID Generator

Provides RFC 4122 UUID compliant GUID generators for .NET platform.

RFC 4122 UUID Standard

RFC 4122 defines the following five versions of UUID:

  • Version 1: The time-based version, contains 60-bit timestamp and 12-bit MAC address
  • Version 2: DCE Security version, contains 28-bit timestamp, 12-bit MAC address and 32-bit local ID
  • Version 3: The name-based version, using MD5 hashing to compute the hash of the namespace and name
  • Version 4: The randomly or pseudo-andomly generated version, equivalent to Guid.NewGuid() in .NET
  • Version 5: The name-based version, using SHA-1 hashing to compute the hash of the namespace and name

There is also a special nil UUID, which is equivalent to Guid.Empty in .NET.

GUID Generator Library Usage

Get Generator Instance by Static Properties

using XNetEx.Guids;
using XNetEx.Guids.Generators;

// time-based GUID generation.
var guidGenV1 = GuidGenerator.Version1;
var guidV1 = guidGenV1.NewGuid();

// name-based GUID generation.
var guidGenV5 = GuidGenerator.Version5;
var guidV5 = guidGenV5.NewGuid(GuidNamespaces.Dns, "github.com");

Get Generator Instance by the Factory Method

using XNetEx.Guids;
using XNetEx.Guids.Generators;

// time-based GUID generation.
var guidGenV1 = GuidGenerator.OfVersion(GuidVersion.Version1);
var guidV1 = guidGenV1.NewGuid();

// name-based GUID generation.
var guidGenV5 = GuidGenerator.OfVersion(GuidVersion.Version5);
var guidV5 = guidGenV5.NewGuid(GuidNamespaces.Dns, "github.com");

Performance Benchmark

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22621
AMD Ryzen 7 5800H with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.101
  [Host]     : .NET 6.0.12 (6.0.1222.56807), X64 RyuJIT
  DefaultJob : .NET 6.0.12 (6.0.1222.56807), X64 RyuJIT
Method GuidCount Mean StdDev Ratio RatioSD
GuidNewGuid 1 53.994 ns 0.5571 ns 1.00 0.00
EmptyGenerate 1 4.053 ns 0.0891 ns 0.08 0.00
GuidV1Generate 1 59.776 ns 2.8263 ns 1.10 0.06
GuidV2Generate 1 77.321 ns 2.2104 ns 1.43 0.05
GuidV3Generate 1 300.388 ns 8.9041 ns 5.56 0.18
GuidV4Generate 1 55.693 ns 1.0418 ns 1.03 0.02
GuidV5Generate 1 284.554 ns 7.4768 ns 5.28 0.17
GuidNewGuid 1000 54,085.285 ns 1,002.7169 ns 1.00 0.00
EmptyGenerate 1000 1,432.027 ns 34.2419 ns 0.03 0.00
GuidV1Generate 1000 56,479.888 ns 652.8100 ns 1.04 0.03
GuidV2Generate 1000 73,021.995 ns 1,672.2725 ns 1.35 0.02
GuidV3Generate 1000 287,743.629 ns 9,264.8141 ns 5.31 0.14
GuidV4Generate 1000 54,519.131 ns 689.9756 ns 1.01 0.02
GuidV5Generate 1000 291,868.157 ns 8,251.6716 ns 5.36 0.18
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XstarS.GuidGenerators:

Package Downloads
XstarS.GuidModule

Provides RFC 4122/9562 compliant GUID operations for F#.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.3 108 11/13/2024
2.4.2 137 11/9/2024 2.4.2 is deprecated because it is no longer maintained.
2.4.1 119 10/10/2024
2.4.0 193 5/12/2024
2.4.0-preview 146 4/20/2024
2.3.1 173 3/24/2024
2.3.0 330 2/24/2024
2.2.1 297 2/8/2024
2.2.0 147 1/26/2024
2.1.2 159 1/22/2024
2.1.1 162 1/20/2024
2.1.0 168 1/12/2024
2.0.0 211 12/24/2023
2.0.0-rc-19 173 12/22/2023
2.0.0-rc-16 194 12/12/2023
2.0.0-rc-15 167 12/6/2023
2.0.0-rc-14 188 11/26/2023
2.0.0-rc-12.5 106 10/15/2023
2.0.0-rc-12 145 10/15/2023 2.0.0-rc-12 is deprecated because it has critical bugs.
2.0.0-rc-00 189 7/15/2023
2.0.0-preview-04.5 91 6/4/2023
2.0.0-preview-04 202 5/28/2023
2.0.0-preview-03.8 81 5/20/2023
2.0.0-preview-03.5 79 5/14/2023
2.0.0-preview-03 208 4/15/2023
2.0.0-preview-02.5 105 3/26/2023
2.0.0-preview-02 206 3/4/2023
2.0.0-preview-01 221 2/12/2023
1.14.3 97 11/13/2024
1.14.2 114 11/9/2024
1.14.1 112 10/10/2024
1.14.0 157 5/12/2024
1.14.0-preview 140 4/20/2024
1.13.0 174 2/24/2024
1.12.1 169 2/8/2024
1.12.0 144 1/26/2024
1.11.2 148 1/22/2024
1.11.1 141 1/20/2024
1.11.0 140 1/12/2024
1.10.0 184 12/24/2023
1.9.5 175 12/22/2023
1.9.1 224 12/12/2023
1.9.0 204 12/6/2023
1.8.0 205 11/26/2023
1.7.8 212 10/15/2023
1.7.5 255 6/4/2023
1.7.1 227 5/28/2023
1.7.0 218 5/20/2023
1.6.0 222 5/13/2023
1.5.0 452 2/5/2023
1.4.0 480 1/21/2023
1.3.1 483 1/15/2023
1.3.0 486 12/31/2022
1.2.0 699 9/30/2022
1.1.0 695 8/5/2022
1.0.1 970 7/5/2022
1.0.0 535 7/3/2022