GuidPhantom 0.0.4

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

// Install GuidPhantom as a Cake Tool
#tool nuget:?package=GuidPhantom&version=0.0.4                

GuidPhantom

Yet another Guid library:-) Create Uuid v1, v3, v5, v6, v7, v8MsSql, v8SHA256, v8SHA512, convert between v1 and v6, convert between v7 and v8MsSql, get Guid info (dissect), create NEWSEQUENTIALID (ms sql), create/reverse Xor Guid, create/reverse numeric Guid, create/reverse incremented Guid.

Version 7 Guid's generated by GuidPhantom 0.0.4 are encoded as:

Bits	
48	Unix timestamp at millisecond precision
4	0x7 (UUID version)
1	Counter segment initialized to 0 when timestamp advances (rollover guard)
11	Counter segment initialized with random data when timestamp advances
2	0x2 (UUID variant)
14	Counter segment initialized with random data when timestamp advances
48	Random data

In case timestamp does not advance, the counter start to increment randomly (1-255). If the counter overflows, the timestamp is incremented + 1 (into the future).

var v1 = GuidKit.CreateVersion1();
var v3 = GuidKit.CreateVersion3(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), "Test42");
var v5 = GuidKit.CreateVersion5(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), "Test42");
var v6 = GuidKit.CreateVersion6();
var v7 = GuidKit.CreateVersion7();
var v8mssql = GuidKit.CreateVersion8MsSql();
var v8sha256 = GuidKit.CreateVersion8SHA256(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), "Test42");
var v8sha512 = GuidKit.CreateVersion8SHA512(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), "Test42");
var v6_converted = v1.ConvertVersion1To6();
var v1_converted = v6.ConvertVersion6To1();
var v7_converted = v8mssql.ConvertVersion8MsSqlTo7();
var v8mssql_converted = v7.ConvertVersion7To8MsSql();
var nsi = GuidKit.CreateNEWSEQUENTIALID();

var vv = nsi.GetVariantAndVersion();
var info = nsi.GetGuidInfo();

var xor = GuidKit.CreateXorGuid(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), new Guid("7e00d52e-8496-4239-92fc-4d59a0cde28d"));
var b = xor.ReverseXorGuid(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"));

var num = GuidKit.CreateNumericGuid(42);
int num42 = num.ReverseNumericGuid();

var inc = GuidKit.CreateIncrementedGuid(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"), 42);
int inc42 = inc.ReverseIncrementedGuid(new Guid("d2f2f0fe-cbf8-4dc8-9ecb-eedd066dc105"));

Also has sql scripts for ms sql server to create Guid v3, v5, v7, v8mssql and convert v7<->v8mssql.

Version 8MsSql: Similar to Version 7, but bits reordered to make it ordered as uniqueidentifier in Ms Sql Server. Ms sql server's uniqueidentifier has strange rules for ordering, so only NEWSEQUENTIALID (non-standard) and v8MsSql will be properly ordered. It is possible to use Version 7 stored as a binary(16) for proper ordering, as long as it is stored as big endian. Can either use big endian byte array's directly from the client, or send Guid/uniqueidentifier from the client and convert to byte array in ms sql, but then need to use eg. dbo.uuid_swap_endian(...), to make it big endian.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.

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
0.0.7 120 9/1/2024
0.0.6 109 8/30/2024
0.0.5 107 8/28/2024
0.0.4 110 8/26/2024
0.0.3 134 8/22/2024
0.0.2 127 8/21/2024
0.0.1 119 8/18/2024