Ksuid 1.0.0

.NET Standard 2.0
dotnet add package Ksuid --version 1.0.0
NuGet\Install-Package Ksuid -Version 1.0.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="Ksuid" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ksuid --version 1.0.0
#r "nuget: Ksuid, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ksuid as a Cake Addin
#addin nuget:?package=Ksuid&version=1.0.0

// Install Ksuid as a Cake Tool
#tool nuget:?package=Ksuid&version=1.0.0

Ksuid

This library implements the K-Sortable Globally Unique IDs from Segment. See also the article called A Brief History of the UUID.

KSUID is for K-Sortable Unique IDentifier. It's a way to generate globally unique IDs similar to RFC 4122 UUIDs, but contain a time component so they can be "roughly" sorted by time of creation. The remainder of the KSUID is randomly generated bytes.

AppVeyor license NuGet NuGet net462 netstandard2.0

Installation

To install Ksuid, run the following command in the Package Manager Console

PM> Install-Package Ksuid

Usage

using KSUID;

var ksuid1 = Ksuid.Generate(); // same as new Ksuid()
Console.WriteLine(ksuid1);
Console.WriteLine(ksuid1.GetTimestamp());
Console.WriteLine(ksuid1.GetUnixTimestamp());

var ksuid2 = Ksuid.FromString("0o5Fs0EELR0fUjHjbCnEtdUwQe3");
Console.WriteLine(ksuid2);
Console.WriteLine(ksuid2.GetTimestamp());
Console.WriteLine(ksuid2.GetUnixTimestamp());

var ksuid3 = new Ksuid(ksuid2.GetPayload());
Console.WriteLine(ksuid3);
Console.WriteLine(ksuid3.GetTimestamp());
Console.WriteLine(ksuid3.GetUnixTimestamp());

var ksuid4 = new Ksuid(ksuid2.GetPayload(), ksuid1.GetTimestamp());
Console.WriteLine(ksuid4);
Console.WriteLine(ksuid4.GetTimestamp());
Console.WriteLine(ksuid4.GetUnixTimestamp());

var ksuid4 = Ksuid.FromByteArray(ksuid2.ToByteArray());
Console.WriteLine(ksuid4);

License

The MIT License

More info see LICENSE

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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
1.0.0 32,982 4/7/2022
1.0.0-build4 30,512 4/9/2018
1.0.0-build3 716 4/8/2018