Cryptor
A lightweight WPF desktop application for encoding, decoding, encrypting, and decrypting text using a variety of algorithms — all from a single, clean interface.
✨ Features
| Algorithm | Encode / Encrypt | Decode / Decrypt |
|---|---|---|
| Base64 | ✅ | ✅ |
| Hex | ✅ | ✅ |
| HTML | ✅ | ✅ |
| URL | ✅ | ✅ |
| AES-GCM | ✅ | ✅ |
| AES-CCM | ✅ | ✅ |
| AES-CNG (CBC) | ✅ | ✅ |
| ChaCha20-Poly1305 | ✅ | ✅ |
| Triple DES | ✅ | ✅ |
| SHA-256 | ✅ | — |
| SHA-512 | ✅ | — |
- MVVM architecture — built with CommunityToolkit.Mvvm
- Authenticated encryption — AES-GCM and AES-CCM are AEAD ciphers that provide both confidentiality and integrity; ChaCha20-Poly1305 provides built-in authentication; all resist tampering and padding-oracle attacks
- Random IV / nonce per operation — a cryptographically random IV or nonce is generated for every encryption call and embedded in the output; no IV/nonce is ever reused
- Secure key input — AES, Triple DES, and ChaCha20-Poly1305 keys are entered via
PasswordBoxand stored asSecureString; intermediate byte arrays (including plaintext) are zeroed immediately after use - Deterministic key cleanup —
SecureStringinstances are disposed via a fullIDisposablechain (MainWindow→MainViewModel→ cryptors →CryptSettings→SettingsViewModel) on window close, zeroing protected memory without waiting for the GC - Shared cryptor base — all cryptors extend a common
CryptorBaseclass that handles lazy settings initialisation,IDisposable(withGC.SuppressFinalize), and settings validation, eliminating duplication across implementations - Allocation-efficient async — methods with no genuine async I/O return
Task.FromResultdirectly instead of generating a compiler state machine; onlyCryptoStream-based operations (AesCng,TripleDES) use trueasync/await - RFC 3986 URL encoding — URL encode/decode uses
Uri.EscapeDataString/Uri.UnescapeDataString(percent-encoding, spaces as%20) instead of the HTML form convention (+) - Windows 11 UI theme — custom implicit styles modelled on the Windows 11 design language (rounded controls, accent blue, Segoe UI Variable typography, slim scrollbars)
- Automatic dark / light mode — reads
AppsUseLightThemefrom the Windows registry on startup and switches live whenever the user changes the system preference in Settings; the native title bar follows via the DWMDWMWA_USE_IMMERSIVE_DARK_MODEattribute - Localization — all UI strings and status messages are stored in
.resxresource files; adding a new language requires only a newStrings.<culture>.resxsatellite file (e.g.Strings.de.resxfor German) - Single-file publish — releases as a self-contained-free, single
win-x64executable
🖥️ Requirements
| Requirement | Version |
|---|---|
| OS | Windows 10 / 11 (x64) |
| Runtime | .NET 10 Desktop Runtime |
🚀 Getting Started
Run from release
- Download the latest executable from the Releases page.
- Ensure the .NET 10 Desktop Runtime is installed.
- Run
CryptorApp.exe.
Build from source
git clone https://github.com/TheBlueHeron/Cryptor.git
cd Cryptor
dotnet build CryptorApp/CryptorApp.csproj
To produce a single-file release build:
dotnet publish CryptorApp/CryptorApp.csproj -c Release
🔐 Usage
- Select an algorithm from the dropdown list.
- For AES, Triple DES, or ChaCha20-Poly1305, enter the key in the settings panel — a fresh random IV or nonce is generated automatically for every encryption:
- AES-GCM: key must be 16, 24, or 32 bytes (8, 12, or 16 Unicode characters). Uses AES-GCM (AEAD) with a random 12-byte nonce per operation. Output layout:
[nonce][tag][ciphertext]. - AES-CCM: same key sizes as AES-GCM. Uses AES-CCM (AEAD) with a random 12-byte nonce per operation. Output layout:
[nonce][tag][ciphertext]. - AES-CNG (CBC): same key sizes as AES-GCM. Uses AES in CBC mode via the Windows CNG provider with a random 16-byte IV per operation. Note: CBC is not authenticated — prefer AES-GCM or AES-CCM when integrity matters. Output layout:
[IV][ciphertext]. - Triple DES: key must be 16 or 24 bytes (non-weak). A random 8-byte IV is generated per operation. Output layout:
[IV][ciphertext]. - ChaCha20-Poly1305: key must be 16 Unicode characters (32 bytes). A random 12-byte nonce is generated per operation. Output layout:
[nonce][tag][ciphertext].
- AES-GCM: key must be 16, 24, or 32 bytes (8, 12, or 16 Unicode characters). Uses AES-GCM (AEAD) with a random 12-byte nonce per operation. Output layout:
- Paste or type the input text.
- Click Convert to see the result.
🏗️ Project Structure
CryptorApp/
├── Common/
│ ├── Crypt.cs # Encoding helpers (StringToBytes, SecureStringToBytes, …)
│ ├── CryptResult.cs # Immutable readonly record struct returned by every ICryptor
│ ├── NativeMethods.cs # P/Invoke helper to apply dark/light mode to the native title bar and exclude window from capture
│ ├── ICryptor.cs # Shared interface for all encode/decode operations
│ └── PasswordBoxHelper.cs # Attached behavior for SecureString ↔ PasswordBox binding
├── Resources/
│ ├── Strings.resx # Neutral (English) UI strings and status messages
│ ├── Strings.Designer.cs # Auto-generated strongly-typed accessor class
│ └── Strings.nl.resx # Dutch translations (sample satellite resource)
├── Cryptors/
│ ├── CryptorBase.cs # Shared abstract base class for all cryptors
│ ├── AesCcmCryptor.cs # AES-CCM (AEAD) encrypt / decrypt
│ ├── AesCngCryptor.cs # AES-CNG / CBC encrypt / decrypt
│ ├── AesGcmCryptor.cs # AES-GCM (AEAD) encrypt / decrypt
│ ├── Base64Cryptor.cs # Base64 encode / decode
│ ├── ChaCha20Cryptor.cs # ChaCha20-Poly1305 encrypt / decrypt
│ ├── HexCryptor.cs # Hex encode / decode
│ ├── HtmlCryptor.cs # HTML encode / decode
│ ├── ShaCryptor.cs # SHA-256 / SHA-512 hashing (encode only)
│ ├── TripleDesCryptor.cs # Triple DES encrypt / decrypt
│ └── UrlCryptor.cs # URL encode / decode (RFC 3986)
├── Themes/
│ ├── Win11DarkColors.xaml # Dark palette colour tokens and brushes
│ ├── Win11LightColors.xaml # Light palette colour tokens and brushes
│ └── Win11Theme.xaml # Implicit control styles and templates (DynamicResource)
├── ViewModels/
│ ├── MainViewModel.cs # Main window view model
│ └── SettingsViewModel.cs # Key / IV settings view model
└── Views/
├── CryptSettings.xaml # Key / IV settings control
└── MainWindow.xaml # Main application window
🎨 Theming
| File | Role |
|---|---|
Win11LightColors.xaml |
Light palette: colour tokens + named brushes |
Win11DarkColors.xaml |
Dark palette: colour tokens + named brushes |
Win11Theme.xaml |
Implicit styles for all controls; all brush references use DynamicResource |
App.xaml.cs reads the Windows registry key AppsUseLightTheme at startup and subscribes to SystemEvents.UserPreferenceChanged to swap MergedDictionaries[0] at runtime — no restart needed. The native title bar is synchronised via DwmHelper, which calls DwmSetWindowAttribute with DWMWA_USE_IMMERSIVE_DARK_MODE.
🌍 Localization
All user-facing strings are defined in Resources/Strings.resx and accessed via the strongly-typed Strings class. XAML views use {x:Static res:Strings.XYZ} bindings; ViewModels and cryptors reference Strings.* directly.
To add a new language:
- Copy
Resources/Strings.resxand rename itStrings.<culture>.resx(e.g.Strings.de.resxfor German). - Translate the
<value>elements — keep all<data name="...">keys identical. - Rebuild. .NET will automatically select the correct satellite assembly based on
Thread.CurrentThread.CurrentUICulture, which is set from the OS locale by default.
| File | Culture |
|---|---|
Strings.resx |
Neutral / English (fallback) |
Strings.nl.resx |
Dutch (nl) |
📦 Dependencies
| Package | Version |
|---|---|
| CommunityToolkit.Mvvm | 8.4.2 |
| Microsoft.Xaml.Behaviors.Wpf | 1.1.142 |
🤝 Contributing
Contributions are welcome! Please open an issue first to discuss what you would like to change, then submit a pull request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
📄 License
Distributed under the MIT License. See LICENSE for details.

