Obfuscation
Obfuscation / Integer Masking library to encrypt numeric id to short string, generating a similar result to YouTube video id.
Install / Use
/learn @kent-id/ObfuscationREADME
Cryptography.Obfuscation
Obfuscator is a C# library that converts a non-negative integer into 8-character string, generating a result similar to YouTube video id. Put it simply, this library converts a numeric id such as 127 to xVrAndNb and back.
Preface
Obfuscation is not designed to to replace your authentication layer, but simply to provide an additional security step. Ideally, your application should be able to authenticate request without, for example, masking/obfuscating id in the query string.
Install
Install-Package Kent.Cryptography.Obfuscation
nuget package link: https://www.nuget.org/packages/Kent.Cryptography.Obfuscation/
Obfuscator 2.0
Obfuscator 2.0 uses a slightly different algorithm compared to version 1.0. New algorithm is introduced to achieve true constant mode across all .NET versions. Prior to version 2.0, constant mode will still achieve expected result as long as you don't change the target framework of your project. If you have been using version 1.0.1 and finds this limitation acceptable, it's safe not to upgrade.
Usage
Basic Example
Provides unique id <> string mapping which will not change unless Seed value is changed.
var obfuscator = new Obfuscator();
string obfuscatedID = obfuscator.Obfuscate(15); // e.g. xVrAndNb
// Reverse-process:
int deobfuscatedID = obfusactor.Deobfuscate(obfuscatedID); // 15
Randomized Mode
Generates randomized sequence which will cause the Obfuscate function to generate different values even when obfuscating the same id.
var obfuscator = new Obfuscator();
obfuscator.Strategy = ObfuscationStrategy.Randomized;
// 'randomized' to generate different sequence for the same id.
string obfuscatedID = obfuscator.Obfuscate(15); // e.g. MzQgC4rL
string secondObfuscatedID = obfuscator.Obfuscate(15); // e.g. 4sucAs0D
// Reverse-process:
int deobfuscatedID = obfusactor.Deobfuscate(obfuscatedID); // 15
deobfuscatedID = obfusactor.Deobfuscate(secondObfuscatedID); // 15
Seed Value
Seed value is the 'differentiator' that makes id <> string mapping unique to your application. It is highly recommended to set this value rather than depending on the default value set by the library (which is 113).
var obfuscator = new Obfuscator();
obfuscator.Seed = 167;
string obfuscatedID = obfuscator.Obfuscate(15);
Note: Minimum seed value is 2 and it's recommended to set this value to varying digits (instead of something like 100), as this will be used in XOR operations. Some example of recommended seed values are 113, 167, 73, etc.
License
This project is licensed under the GNU Public License v3.0. Feel free to reuse for personal and commercial use.
Related Skills
qqbot-channel
342.5kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
99.6k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
342.5kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
