PrettyId 1.0.0.4

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

// Install PrettyId as a Cake Tool
#tool nuget:?package=PrettyId&version=1.0.0.4

alt tag

PrettyId

NuGet Version NuGet

PrettyId is a simple library for creating uniform IDs similar to those used by Stripe.

Under the hood, PrettyId uses base64 strings of GUIDs to generate a random identifier of the specified length. You can choose to set a prefix that can be included in the result.

New in v1.0.0

  • Initial release

Help or feedback

First things first - do you need help or have feedback? File an issue here!

Performance and Security

It's pretty quick 😃 The shorter the list of allowed characters, the slower it will run.

On security, the library has no way to guarantee that it will never issue the same ID twice. It is however based on GUIDs, which have a ridiculously low theoretical probability of collision (I would encourage you to check out Stephen Cleary's blog post at https://blog.stephencleary.com/2010/11/few-words-on-guids.html)

Simple Example

using PrettyId;

Console.WriteLine(IdGenerator.Generate("data_", 32));
// data_0mAg6shuO0GSplEn7GmXR

Console.WriteLine(IdGenerator.Generate(64));
// KL5ULxfC2kujhcMtDKnDKgUAANsBAdESqJBDKIgvLwdxfjo03uJEKLkn9csMt4Q

Console.WriteLine(IdGenerator.Generate());
// 5wS4rcgWk6Tr0CO0sfXgA0NAtlOp60C

Want to set the list of valid characters?

IdGenerator.ValidCharacters = new char[] { 'a', 'b', 'c', 'd', ... };

Note With fewer characters, it will take longer to generate an ID, and there is a mechanism internally to iterate over new GUIDs a maximum of MaxIterations times. If this number of iterations is exceeded, an exception will be thrown. Additionally, only valid base64 characters should be included in the list.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 was computed.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on PrettyId:

Package Downloads
S3Server

Emulated Amazon Web Services (AWS) Simple Storage Service (S3) server-side interface.

S3Lite

Lightweight Amazon S3 client without all the heft and dependency drag of the official library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 184 3/20/2024
1.0.1 2,964 8/31/2023
1.0.0.4 931 8/19/2023
1.0.0.3 7,887 11/19/2021
1.0.0.2 493 11/18/2021
1.0.0.1 473 11/12/2021
1.0.0 7,178 4/16/2021

Strong naming.