Skip to main content
CSharpVitamins.ShortGuid package icon

CSharpVitamins.ShortGuid

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.

Total Downloads
3.4M
3,431,870
Published
Mar 11, 2021
Latest stable version

Install

.NET CLI
dotnet add package CSharpVitamins.ShortGuid --version 2.0.0
Package Manager Console
Install-Package CSharpVitamins.ShortGuid -Version 2.0.0
PackageReference
<PackageReference Include="CSharpVitamins.ShortGuid" Version="2.0.0" />

Frameworks

.NETFramework4.0 .NETStandard2.0

Dependencies

No declared dependencies.

Adoption guide

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

How to read this guidance

Sources: published NuGet v3 registry metadata and explicit NuBrowse editorial guides. Refresh: package metadata is refreshed from NuGet when the page loads. Limit: this is not a security, legal or compatibility guarantee; validate the selected version in your project.

Useful next steps

Move from package metadata to a concrete selection or review workflow.