XorInterceptor 1.0.0
dotnet add package XorInterceptor --version 1.0.0
NuGet\Install-Package XorInterceptor -Version 1.0.0
<PackageReference Include="XorInterceptor" Version="1.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="XorInterceptor" Version="1.0.0" />
<PackageReference Include="XorInterceptor"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add XorInterceptor --version 1.0.0
#r "nuget: XorInterceptor, 1.0.0"
#:package XorInterceptor@1.0.0
#addin nuget:?package=XorInterceptor&version=1.0.0
#tool nuget:?package=XorInterceptor&version=1.0.0
XorInterceptor
A .NET Interceptor which does a simple XOR encryption at compile time, without embedding the plaintext literal in your IL.
It scans the syntax tree for calls named Xor
with zero arguments. It retrieves the interceptable location from the compiler and it will emit the interceptor method, instead of the original call.
⚠️ This currently requires .NET 9
Installation
Option A — NuGet (recommended)
NuGet
.NET CLI
dotnet add package XorInterceptor
Package Reference
<PackageReference Include="XorInterceptor" Version="1.0.*" />
Option B — Local project reference
</PropertyGroup>
<InterceptorsNamespaces>$(InterceptorsNamespaces);XorInterceptor</InterceptorsNamespaces>
<XorBuildSeed>$([System.Guid]::NewGuid().GetHashCode())</XorBuildSeed>
</PropertyGroup>
<ItemGroup>
<CompilerVisibleProperty Include="XorBuildSeed" />
<ProjectReference Include="..\XorInterceptor\XorInterceptor.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
Usage
You can take a look at the console application included, however it is nothing more than:
using static XorInterceptor.XorEncryption;
var encryptedString = Xor( /*"Hello, World"*/);
Console.WriteLine(encryptedString);
Now each time you (re)build your project the encryption changes.
⚠️ This is of course very easy to undo, since both the encrypted data and the key are next to eachother. It is more a proof of concept. <img width="1100" height="900" alt="image" src="https://github.com/user-attachments/assets/731019b2-acd2-4f00-a2ce-e61d05bb33f1" />
References
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 128 | 8/31/2025 |