Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
82744aa
docs: design spec for consolidating Abstractions + Common into Essent…
matt-edmondson Jun 29, 2026
a493872
docs: implementation plan for Essentials consolidation (Phase 1)
matt-edmondson Jun 29, 2026
5543479
feat: add IObfuscationProvider interface to Essentials core
matt-edmondson Jun 29, 2026
1505afd
feat: add Xor obfuscation provider and obfuscation test harness
matt-edmondson Jun 29, 2026
fa61814
feat: add Caesar obfuscation provider
matt-edmondson Jun 29, 2026
ab27e26
test: scope obfuscation string round-trip out of the shared byte-tran…
matt-edmondson Jun 29, 2026
f935f7f
feat: add Reverse obfuscation provider
matt-edmondson Jun 29, 2026
342b44d
feat: add BitRotate obfuscation provider
matt-edmondson Jun 29, 2026
dda0e33
feat: add Base64 obfuscation provider composing the Base64 encoder
matt-edmondson Jun 29, 2026
d4f03a2
fix: keep Base64 obfuscator encoder ctor public; register via factory…
matt-edmondson Jun 29, 2026
786b4fc
feat: add Hex obfuscation provider composing the Hex encoder
matt-edmondson Jun 29, 2026
d156bb1
feat: add Composite obfuscation provider that pipelines a chain
matt-edmondson Jun 29, 2026
f88ff75
refactor: conform serialization providers to SDK naming convention
matt-edmondson Jun 30, 2026
614ad9a
refactor: conform all providers to SDK naming convention
matt-edmondson Jun 30, 2026
b602dee
feat: port NewtonsoftJson serialization provider from Common
matt-edmondson Jul 1, 2026
3ac1ffd
feat: add ktsu.Essentials.All meta-package
matt-edmondson Jul 1, 2026
bce97a2
docs: document obfuscation, NewtonsoftJson, All meta-package, and new…
matt-edmondson Jul 1, 2026
c64d469
Merge origin/main into consolidate-into-essentials
matt-edmondson Jul 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dotnet build -c Release

## Project Structure

This is a .NET library (`ktsu.Essentials`) providing high-performance interfaces and implementations for common cross-cutting concerns: compression, encoding, encryption, hashing, serialization, caching, persistence, validation, logging, navigation, command execution, and filesystem access. The solution uses:
This is a .NET library (`ktsu.Essentials`) providing high-performance interfaces and implementations for common cross-cutting concerns: compression, encoding, obfuscation, encryption, hashing, serialization, caching, persistence, validation, logging, navigation, command execution, and filesystem access. The solution uses:

- **ktsu.Sdk** - Custom SDK providing shared build configuration
- **MSTest.Sdk** - Test project SDK with Microsoft Testing Platform
Expand All @@ -29,6 +29,7 @@ This is a .NET library (`ktsu.Essentials`) providing high-performance interfaces

- `Essentials/ICompressionProvider.cs` - Compression/decompression interface with Span, Stream, and string support
- `Essentials/IEncodingProvider.cs` - Format/transport encoding interface (Base64, Hex)
- `Essentials/IObfuscationProvider.cs` - Reversible obfuscation interface (NOT encryption); implementations compose encoding transforms and simple byte operations
- `Essentials/IEncryptionProvider.cs` - Encryption/decryption interface with key/IV management
- `Essentials/IHashProvider.cs` - Hashing interface with configurable output length
- `Essentials/ISerializationProvider.cs` - Object serialization/deserialization interface
Expand All @@ -46,21 +47,26 @@ This is a .NET library (`ktsu.Essentials`) providing high-performance interfaces

### Provider Implementations (in solution)

- **CompressionProviders/**: Gzip, Brotli, Deflate, ZLib — namespace `ktsu.Essentials.CompressionProviders`
- **EncodingProviders/**: Base64, Hex — namespace `ktsu.Essentials.EncodingProviders`
- **EncryptionProviders/**: Aes — namespace `ktsu.Essentials.EncryptionProviders`
- **HashProviders/**: MD5, SHA1, SHA256, SHA384, SHA512, FNV1_32, FNV1a_32, FNV1_64, FNV1a_64, CRC32, CRC64, XxHash32, XxHash64, XxHash3, XxHash128 — namespace `ktsu.Essentials.HashProviders`
- **SerializationProviders/**: Json, Yaml, Toml — namespace `ktsu.Essentials.SerializationProviders`
- **FileSystemProviders/**: Native — namespace `ktsu.Essentials.FileSystemProviders`
- **CommandExecutors/**: Native — namespace `ktsu.Essentials.CommandExecutors`
- **LoggingProviders/**: Console — namespace `ktsu.Essentials.LoggingProviders`
- **CacheProviders/**: InMemory — namespace `ktsu.Essentials.CacheProviders`
- **NavigationProviders/**: InMemory — namespace `ktsu.Essentials.NavigationProviders`
- **PersistenceProviders/**: AppData, FileSystem, InMemory, Temp — namespace `ktsu.Essentials.PersistenceProviders`
Each provider implementation ships as its own project/package named `Essentials.<Category>.<Impl>` (NuGet id `ktsu.Essentials.<Category>.<Impl>`):

### Namespace Convention
- **CompressionProviders**: Gzip, Brotli, Deflate, ZLib (ZLib targets net6.0+ only, not netstandard2.1)
- **EncodingProviders**: Base64, Hex
- **ObfuscationProviders**: Xor, Caesar, Reverse, BitRotate, Base64, Hex, Composite
- **EncryptionProviders**: Aes
- **HashProviders**: MD5, SHA1, SHA256, SHA384, SHA512, FNV1_32, FNV1a_32, FNV1_64, FNV1a_64, CRC32, CRC64, XxHash32, XxHash64, XxHash3, XxHash128
- **SerializationProviders**: Json (System.Text.Json), NewtonsoftJson, Yaml, Toml
- **FileSystemProviders**: Native
- **CommandExecutors**: Native
- **LoggingProviders**: Console
- **CacheProviders**: InMemory
- **NavigationProviders**: InMemory
- **PersistenceProviders**: AppData, FileSystem, InMemory, Temp

Interfaces are defined in the `ktsu.Essentials` namespace (in the `Essentials/` directory). Provider implementations use sub-namespaces matching their category directory: `ktsu.Essentials.<Category>`. For example, `SHA256` is in `ktsu.Essentials.HashProviders` and `Gzip` is in `ktsu.Essentials.CompressionProviders`.
The **`Essentials.All`** project (`ktsu.Essentials.All`) is a meta-package that references every provider implementation for a one-install "batteries-included" experience; consumers can otherwise cherry-pick individual provider packages.

### Namespace & Naming Convention

Interfaces are defined in the `ktsu.Essentials` namespace (in the `Essentials/` directory). Each provider implementation lives in its own directory `Essentials.<Category>.<Impl>/`, in namespace `ktsu.Essentials.<Category>.<Impl>`, with the class named `<Impl><Category-singular>Provider`. For example, the SHA-256 hash provider is class `SHA256HashProvider` in namespace `ktsu.Essentials.HashProviders.SHA256`, and the XOR obfuscator is class `XorObfuscationProvider` in `ktsu.Essentials.ObfuscationProviders.Xor`. Higher-level concerns compose primitives rather than duplicating them: configuration is an `IPersistenceProvider<TKey>` over a serializer, and each obfuscator composes an encoding transform or a simple reversible byte operation. Obfuscators that wrap an `IEncodingProvider` (Base64, Hex) keep both a parameterless and an encoder-accepting constructor public and are registered via a DI factory lambda to avoid greedy-constructor selection.

### Dependencies

Expand Down Expand Up @@ -95,6 +101,7 @@ Tests use **MSTest.Sdk** targeting net10.0 only. The test project (`Essentials.T
- `CacheProviderTests.cs` - Tests cache operations including expiration
- `CommandExecutorTests.cs` - Tests command execution
- `EncodingProviderTests.cs` - Tests Base64 and Hex encoding
- `ObfuscationProviderTests.cs` - Tests all obfuscation providers via round-trip (obfuscate → deobfuscate)
- `FileSystemProviderTests.cs` - Tests filesystem operations
- `LoggingProviderTests.cs` - Tests logging provider
- `NavigationProviderTests.cs` - Tests navigation stack behavior
Expand Down
20 changes: 0 additions & 20 deletions CompressionProviders/Gzip/Gzip.csproj

This file was deleted.

2 changes: 1 addition & 1 deletion DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
A comprehensive .NET library providing high-performance interfaces and ready-to-use implementations for common cross-cutting concerns including compression (Gzip, Brotli, Deflate, ZLib), encoding (Base64, Hex), encryption (AES), hashing (15 algorithms including SHA, MD5, CRC, FNV, XxHash), serialization (JSON, YAML, TOML), caching, persistence, validation, logging, navigation, command execution, and filesystem access. Features zero-allocation Span-based operations, default interface implementations to minimize boilerplate, and comprehensive async support with CancellationToken.
A comprehensive .NET library providing high-performance interfaces and ready-to-use implementations for common cross-cutting concerns including compression (Gzip, Brotli, Deflate, ZLib), encoding (Base64, Hex), obfuscation (XOR, Caesar, bit-rotation, byte-reversal, Base64, Hex, and composable chains), encryption (AES), hashing (15 algorithms including SHA, MD5, CRC, FNV, XxHash), serialization (System.Text.Json, Newtonsoft.Json, YAML, TOML), caching, persistence, validation, logging, navigation, command execution, and filesystem access. Features zero-allocation Span-based operations, default interface implementations to minimize boilerplate, and comprehensive async support with CancellationToken. Install everything with the ktsu.Essentials.All meta-package, or cherry-pick individual provider packages.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PackageVersion Include="Microsoft.Testing.Extensions.HotReload" Version="1.7.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.Retry" Version="1.7.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.7.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="Polyfill" Version="9.8.0" />
<PackageVersion Include="System.IO.Hashing" Version="9.0.3" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
Expand Down
20 changes: 0 additions & 20 deletions EncodingProviders/Base64/Base64.csproj

This file was deleted.

20 changes: 0 additions & 20 deletions EncodingProviders/Hex/Hex.csproj

This file was deleted.

20 changes: 0 additions & 20 deletions EncryptionProviders/Aes/Aes.csproj

This file was deleted.

59 changes: 59 additions & 0 deletions Essentials.All/Essentials.All.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="ktsu.Sdk" />

<PropertyGroup>
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0;netstandard2.1</TargetFrameworks>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<!-- Polyfill provides per-TFM shims, so strict ApiCompat package validation reports false cross-TFM diffs; disable it (matches ktsu.Semantics). -->
<EnablePackageValidation>false</EnablePackageValidation>
<IncludeBuildOutput>false</IncludeBuildOutput>
<Description>Batteries-included meta-package that references every ktsu.Essentials provider implementation.</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Essentials.CacheProviders.InMemory\Essentials.CacheProviders.InMemory.csproj" />
<ProjectReference Include="..\Essentials.CommandExecutors.Native\Essentials.CommandExecutors.Native.csproj" />
<ProjectReference Include="..\Essentials.CompressionProviders.Brotli\Essentials.CompressionProviders.Brotli.csproj" />
<ProjectReference Include="..\Essentials.CompressionProviders.Deflate\Essentials.CompressionProviders.Deflate.csproj" />
<ProjectReference Include="..\Essentials.CompressionProviders.Gzip\Essentials.CompressionProviders.Gzip.csproj" />
<!-- ZLib targets net6.0+ only (requires ZLibStream); excluded from netstandard2.1 -->
<ProjectReference Include="..\Essentials.CompressionProviders.ZLib\Essentials.CompressionProviders.ZLib.csproj" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
<ProjectReference Include="..\Essentials.EncodingProviders.Base64\Essentials.EncodingProviders.Base64.csproj" />
<ProjectReference Include="..\Essentials.EncodingProviders.Hex\Essentials.EncodingProviders.Hex.csproj" />
<ProjectReference Include="..\Essentials.EncryptionProviders.Aes\Essentials.EncryptionProviders.Aes.csproj" />
<ProjectReference Include="..\Essentials.FileSystemProviders.Native\Essentials.FileSystemProviders.Native.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.CRC32\Essentials.HashProviders.CRC32.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.CRC64\Essentials.HashProviders.CRC64.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.FNV1_32\Essentials.HashProviders.FNV1_32.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.FNV1_64\Essentials.HashProviders.FNV1_64.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.FNV1a_32\Essentials.HashProviders.FNV1a_32.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.FNV1a_64\Essentials.HashProviders.FNV1a_64.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.MD5\Essentials.HashProviders.MD5.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.SHA1\Essentials.HashProviders.SHA1.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.SHA256\Essentials.HashProviders.SHA256.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.SHA384\Essentials.HashProviders.SHA384.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.SHA512\Essentials.HashProviders.SHA512.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.XxHash128\Essentials.HashProviders.XxHash128.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.XxHash3\Essentials.HashProviders.XxHash3.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.XxHash32\Essentials.HashProviders.XxHash32.csproj" />
<ProjectReference Include="..\Essentials.HashProviders.XxHash64\Essentials.HashProviders.XxHash64.csproj" />
<ProjectReference Include="..\Essentials.LoggingProviders.Console\Essentials.LoggingProviders.Console.csproj" />
<ProjectReference Include="..\Essentials.NavigationProviders.InMemory\Essentials.NavigationProviders.InMemory.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Base64\Essentials.ObfuscationProviders.Base64.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.BitRotate\Essentials.ObfuscationProviders.BitRotate.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Caesar\Essentials.ObfuscationProviders.Caesar.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Composite\Essentials.ObfuscationProviders.Composite.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Hex\Essentials.ObfuscationProviders.Hex.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Reverse\Essentials.ObfuscationProviders.Reverse.csproj" />
<ProjectReference Include="..\Essentials.ObfuscationProviders.Xor\Essentials.ObfuscationProviders.Xor.csproj" />
<ProjectReference Include="..\Essentials.PersistenceProviders.AppData\Essentials.PersistenceProviders.AppData.csproj" />
<ProjectReference Include="..\Essentials.PersistenceProviders.FileSystem\Essentials.PersistenceProviders.FileSystem.csproj" />
<ProjectReference Include="..\Essentials.PersistenceProviders.InMemory\Essentials.PersistenceProviders.InMemory.csproj" />
<ProjectReference Include="..\Essentials.PersistenceProviders.Temp\Essentials.PersistenceProviders.Temp.csproj" />
<ProjectReference Include="..\Essentials.SerializationProviders.Json\Essentials.SerializationProviders.Json.csproj" />
<ProjectReference Include="..\Essentials.SerializationProviders.NewtonsoftJson\Essentials.SerializationProviders.NewtonsoftJson.csproj" />
<ProjectReference Include="..\Essentials.SerializationProviders.Toml\Essentials.SerializationProviders.Toml.csproj" />
<ProjectReference Include="..\Essentials.SerializationProviders.Yaml\Essentials.SerializationProviders.Yaml.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Essentials\Essentials.csproj" />
<ProjectReference Include="..\Essentials\Essentials.csproj" />
<PackageReference Include="Polyfill" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) ktsu.dev
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.

namespace ktsu.Essentials.CacheProviders;
namespace ktsu.Essentials.CacheProviders.InMemory;

using ktsu.Essentials;
using System;
Expand All @@ -13,7 +13,7 @@ namespace ktsu.Essentials.CacheProviders;
/// </summary>
/// <typeparam name="TKey">The type of the cache key.</typeparam>
/// <typeparam name="TValue">The type of the cached value.</typeparam>
public class InMemory<TKey, TValue> : ICacheProvider<TKey, TValue> where TKey : notnull
public class InMemoryCacheProvider<TKey, TValue> : ICacheProvider<TKey, TValue> where TKey : notnull
{
private readonly ConcurrentDictionary<TKey, CacheEntry> cache = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Essentials\Essentials.csproj" />
<ProjectReference Include="..\Essentials\Essentials.csproj" />
<PackageReference Include="Polyfill" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) ktsu.dev
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.

namespace ktsu.Essentials.CommandExecutors;
namespace ktsu.Essentials.CommandExecutors.Native;

using ktsu.Essentials;
using System;
Expand All @@ -15,7 +15,7 @@ namespace ktsu.Essentials.CommandExecutors;
/// <summary>
/// A command executor that uses the native operating system shell to execute commands.
/// </summary>
public class Native : ICommandExecutor
public class NativeCommandExecutor : ICommandExecutor
{
/// <summary>
/// Executes a command asynchronously and returns the result.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) ktsu.dev
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.

namespace ktsu.Essentials.CompressionProviders;
namespace ktsu.Essentials.CompressionProviders.Brotli;

using ktsu.Essentials;
using System;
Expand All @@ -12,7 +12,7 @@ namespace ktsu.Essentials.CompressionProviders;
/// <summary>
/// A compression provider that uses Brotli for data compression and decompression.
/// </summary>
public class Brotli : ICompressionProvider
public class BrotliCompressionProvider : ICompressionProvider
{
/// <summary>
/// Tries to compress the data from the span and write the result to the destination.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Essentials\Essentials.csproj" />
<ProjectReference Include="..\Essentials\Essentials.csproj" />
<PackageReference Include="Polyfill" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) ktsu.dev
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.

namespace ktsu.Essentials.CompressionProviders;
namespace ktsu.Essentials.CompressionProviders.Deflate;

using ktsu.Essentials;
using System;
Expand All @@ -12,7 +12,7 @@ namespace ktsu.Essentials.CompressionProviders;
/// <summary>
/// A compression provider that uses Deflate for data compression and decompression.
/// </summary>
public class Deflate : ICompressionProvider
public class DeflateCompressionProvider : ICompressionProvider
{
/// <summary>
/// Tries to compress the data from the span and write the result to the destination.
Expand Down
Loading
Loading