NuciText.Obfuscation is a lightweight .NET library for text obfuscation using visually similar Unicode characters.
It can:
- Obfuscate readable text while preserving visual similarity
- Reverse known substitutions through deobfuscation
- Produce deterministic results with a fixed seed
- Optionally include approximate replacements for stronger obfuscation
- Randomized obfuscation based on configurable seed
- Support for both single-character and grouped replacements
- Optional approximate substitutions via options
- Null-safe and empty-string-safe API behavior
- Simple API surface (
Obfuscate/Deobfuscate)
dotnet add package NuciText.ObfuscationInstall-Package NuciText.Obfuscationusing NuciText.Obfuscation;
INuciTextObfuscator obfuscator = new NuciTextObfuscator();
string input = "Test string!";
string obfuscated = obfuscator.Obfuscate(input);
string restored = obfuscator.Deobfuscate(obfuscated);If you need reproducible output (for tests or snapshots), use a fixed seed.
using NuciText.Obfuscation;
var options = new NuciTextObfuscatorOptions
{
UseApproximateReplacements = true
};
INuciTextObfuscator obfuscator = new NuciTextObfuscator(123456789);
string plain = "Test string!";
string obfuscated = obfuscator.Obfuscate(plain, options);
// obfuscated == "Ꭲеst strіng!"
string restored = obfuscator.Deobfuscate(obfuscated);
// restored == "Test string!"INuciTextObfuscator
string Obfuscate(string text)string Obfuscate(string text, NuciTextObfuscatorOptions options)string Deobfuscate(string text)
NuciTextObfuscator constructors
NuciTextObfuscator()NuciTextObfuscator(int seed)NuciTextObfuscator(string seed)
NuciTextObfuscatorOptions
bool UseApproximateReplacements(default:false)
- Passing
nullreturnsnull. - Passing an empty string returns an empty string.
- Obfuscation is probabilistic by default.
- Deobfuscation restores known substitutions from the internal mapping tables.
- .NET SDK compatible with the target framework
NuciText.Obfuscation/- main libraryNuciText.Obfuscation.UnitTests/- NUnit test project
dotnet build NuciText.Obfuscation.csprojdotnet run --project NuciText.Obfuscation.csprojdotnet testContributions are welcome.
When contributing:
- keep the project cross-platform
- preserve the existing public API unless a breaking change is intentional
- keep the changes focused and consistent with the the current coding style
- update the documentation when behavior changes
- include tests for any new behavior
Licensed under the GNU General Public License v3.0 or later. See LICENSE for details.
