NGuid 0.2.0

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

// Install NGuid as a Cake Tool
#tool nuget:?package=NGuid&version=0.2.0                

NGuid

NGuid provides efficient creation of name-based and random GUIDs according to RFC 4122 and the current revision working draft:

  • Version 3 - created from an MD5 hash of a name
  • Version 5 - created from a SHA1 hash of a name
  • Version 6 - a field-compatible version of UUIDv1, reordered for improved DB locality
  • Version 7 - a time-ordered value based on a Unix timestamp
  • Version 8 - an RFC-compatible format for experimental or vendor-specific use cases

Usage

// returns a "Version 5" UUID by default: {74738ff5-5367-5958-9aee-98fffdcd1876}
var guid = GuidHelpers.CreateFromName(GuidHelpers.DnsNamespace, "www.example.org"u8);

// can also create "Version 3": {0012416f-9eec-3ed4-a8b0-3bceecde1cd9}
var guidv3 = GuidHelpers.CreateFromName(GuidHelpers.DnsNamespace, "www.example.org"u8, version: 3);

Experimental

The following APIs are based on the current working draft and are subject to change:

// converts {6ba7b810-9dad-11d1-80b4-00c04fd430c8} to {1d19dad6-ba7b-6810-80b4-00c04fd430c8}
var guidv6 = GuidHelpers.CreateVersion6FromVersion1(GuidHelpers.DnsNamespace);

// creates a v7 GUID using the current time and random data 
var guidv7 = GuidHelpers.CreateVersion7();

// .NET 8 only: specify a TimeProvider to provide the timestamp
var guidv7WithTime = GuidHelpers.CreateVersion7(TimeProvider.System);

// creates a v8 GUID using the specified data
ReadOnlySpan<byte> bytes = GetBytes();
var guidv8 = GuidHelpers.CreateVersion8(bytes);

// creates a name-based v8 GUID using the specified hash algorithm
var guidv8ForName = GuidHelpers.CreateVersion8FromName(HashAlgorithmName.SHA256,
    GuidHelpers.DnsNamespace, "www.example.com"u8);
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 is compatible.  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 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  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.
  • .NETStandard 2.0

  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NGuid:

Package Downloads
Jc.Core.Database

简单好用的.net开源Orm框架 https://github.com/279328316/JcCore

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 10,262 10/5/2024
0.3.0 193,046 2/8/2024
0.2.0 89,402 7/3/2023
0.1.0 240 7/2/2023