Dosaic.Extensions.Sqids 1.2.14

dotnet add package Dosaic.Extensions.Sqids --version 1.2.14
                    
NuGet\Install-Package Dosaic.Extensions.Sqids -Version 1.2.14
                    
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="Dosaic.Extensions.Sqids" Version="1.2.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dosaic.Extensions.Sqids" Version="1.2.14" />
                    
Directory.Packages.props
<PackageReference Include="Dosaic.Extensions.Sqids" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dosaic.Extensions.Sqids --version 1.2.14
                    
#r "nuget: Dosaic.Extensions.Sqids, 1.2.14"
                    
#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.
#:package Dosaic.Extensions.Sqids@1.2.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dosaic.Extensions.Sqids&version=1.2.14
                    
Install as a Cake Addin
#tool nuget:?package=Dosaic.Extensions.Sqids&version=1.2.14
                    
Install as a Cake Tool

Dosaic.Extensions.Sqids

Dosaic.Extensions.Sqids is an extension library that provides string methods to encode and decode values using the Sqids algorithm — producing short, YouTube-like identifiers that are URL-safe and reversible.

Installation

dotnet add package Dosaic.Extensions.Sqids

or add as a package reference to your .csproj:

<PackageReference Include="Dosaic.Extensions.Sqids" Version="" />

Features

  • ToSqid() — encode any string (including Unicode) into a Sqid
  • FromSqid() — decode a Sqid back to the original string (guaranteed round-trip)
  • Default encoder — pre-configured with a shuffled alphabet and minimum length of 10
  • Custom encoder — pass a SqidsEncoder<char> instance to override encoding options per-call
  • Global encoder override — replace the default encoder application-wide via SqidExtensions.Encoder
  • Null safety — both methods throw ArgumentNullException immediately for null inputs
  • Unicode support — encodes and decodes non-ASCII strings (e.g. Chinese, emoji) correctly

Usage

Basic Encoding and Decoding

using Dosaic.Extensions.Sqids;

// Encode a string to a Sqid
string sqid = "HelloWorld".ToSqid();
// e.g. "kKs7PVdXUYnH" (length >= 10, URL-safe)

// Decode back to the original string
string original = sqid.FromSqid();
// "HelloWorld"

Round-tripping is guaranteed with the same encoder:

string value = "ComplexString123";
string result = value.ToSqid().FromSqid();
// result == "ComplexString123"

Unicode and Special Characters

string unicode = "你好世界".ToSqid();
string decoded = unicode.FromSqid();
// decoded == "你好世界"

string special = "!@#$%^&*()".ToSqid();

Custom Encoder

Supply a SqidsEncoder<char> directly to override options on a per-call basis without affecting the global encoder:

using Dosaic.Extensions.Sqids;
using Sqids;

var encoder = new SqidsEncoder<char>(new SqidsOptions
{
    Alphabet = "abcdefghijklmnopqrstuvwxyz0123456789",
    MinLength = 5
});

string sqid     = "Hello".ToSqid(encoder);
string original = sqid.FromSqid(encoder);
// original == "Hello"

Configuration

The default encoder is a static property and can be replaced application-wide:

using Dosaic.Extensions.Sqids;
using Sqids;

SqidExtensions.Encoder = new SqidsEncoder<char>(new SqidsOptions
{
    Alphabet  = "yourCustomAlphabetHere",
    MinLength = 12
});

Default settings:

Option Value
Alphabet kKsW7PVdXUYnHgQ6rujl0GepfNzB2qZ9bC83IyDmOAtJ4hcSvM1Roaw5LxEiTF
MinLength 10

Use Cases

  • Creating short, URL-friendly identifiers from arbitrary strings
  • Obfuscating sequential or predictable IDs in public-facing URLs
  • Generating consistent, reversible short codes for sharing links
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Dosaic.Extensions.Sqids:

Package Downloads
Dosaic.Plugins.Persistence.S3

A plugin-first dotnet framework for rapidly building anything hosted in the web.

Dosaic.Plugins.Persistence.VaultSharp

A plugin-first dotnet framework for rapidly building anything hosted in the web.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.14 0 3/30/2026
1.2.13 44 3/26/2026
1.2.12 62 3/24/2026
1.2.11 105 3/17/2026
1.2.10 111 3/16/2026
1.2.9 103 3/13/2026
1.2.8 112 3/9/2026
1.2.7 99 3/4/2026
1.2.6 128 2/19/2026
1.2.5 108 2/17/2026
1.2.4 129 2/13/2026
1.2.3 133 1/27/2026
1.2.2 319 12/16/2025
1.2.1 302 12/16/2025
1.2.0 450 12/11/2025
1.1.21 478 12/10/2025
1.1.20 448 11/18/2025
1.1.19 337 11/11/2025
1.1.18 237 10/14/2025
1.1.17 234 10/1/2025
Loading failed