CSharpVitamins.ShortGuid NuGet Package

A convenience wrapper struct for dealing with URL-safe Base64 encoded globally unique identifiers (GUID),
making a shorter string value (22 vs 36 characters long).

As of version 2.0.0, `ShortGuid` performs a sanity check when decoding strings to ensure they haven't been
tampered with, i.e.

allowing the end of a Base64 string to be tweaked where it still produces that same
byte array to create the underlying Guid. Effectively there is "unused space" in the Base64 string which is
ignored, but will now result in an `FormatException` being thrown.

ShortGuid will never produce an invalid string, however if one is supplied, it could result in an unintended
collision where multiple URL-safe Base64 strings can point to the same Guid.

To avoid this uncertainty, a
round-trip check is performed to ensure a 1-1 match with the input string.

Stick with version 1.1.0 if you require the old behaviour with opt-in strict parsing.




Got any CSharpVitamins.ShortGuid Question?





Info

Version: 2.0.0
Author(s): Dave Transom
Last Update: Thursday, March 11, 2021
.NET Fiddle: Online Example
Project Url: https://github.com/csharpvitamins/csharpvitamins.shortguid/
NuGet Url: https://www.nuget.org/packages/CSharpVitamins.ShortGuid


Install
Install-Package CSharpVitamins.ShortGuid
dotnet add package CSharpVitamins.ShortGuid
paket add CSharpVitamins.ShortGuid
CSharpVitamins.ShortGuid Download (Unzip the "nupkg" after downloading)

.NETFramework 4.0
  • No dependencies.
.NETStandard 2.0
  • No dependencies.


Tags



STATS

must-have-score

1.8

avg-downloads-per-day

81

days-since-last-release

1114