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.
To install Ksuid, run the following command in the Package Manager Console
PM> Install-Package Ksuid
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);
The MIT License
More info see LICENSE