Dosaic.Extensions.Sqids 1.2.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dosaic.Extensions.Sqids --version 1.2.12
                    
NuGet\Install-Package Dosaic.Extensions.Sqids -Version 1.2.12
                    
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.12" />
                    
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.12" />
                    
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.12
                    
#r "nuget: Dosaic.Extensions.Sqids, 1.2.12"
                    
#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.12
                    
#: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.12
                    
Install as a Cake Addin
#tool nuget:?package=Dosaic.Extensions.Sqids&version=1.2.12
                    
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.28 40 4/30/2026
1.2.27 57 4/29/2026
1.2.26 56 4/29/2026
1.2.25 115 4/27/2026
1.2.24 108 4/21/2026
1.2.23 110 4/14/2026
1.2.22 105 4/10/2026
1.2.21 118 4/10/2026
1.2.20 103 4/10/2026
1.2.19 109 4/9/2026
1.2.18 117 4/2/2026
1.2.17 105 4/1/2026
1.2.16 106 4/1/2026
1.2.15 109 3/31/2026
1.2.14 111 3/30/2026
1.2.13 115 3/26/2026
1.2.12 125 3/24/2026
1.2.11 116 3/17/2026
1.2.10 123 3/16/2026
1.2.9 117 3/13/2026
Loading failed