A console utility demonstrating a multi-pass substitution cipher for text files. This program applies a simple, keyed character-shifting mechanism across multiple layers, requiring the successful reversal of each layer for decryption.
Disclaimer: This tool is for educational demonstration of cipher chaining and key management concepts. It uses a basic Vigenère-like cipher and is not suitable for protecting sensitive or mission-critical data.
The application uses the Unicode/ASCII value of each character in the file content and shifts it by the corresponding value of a character in the key (password), cycling through the key length.
The fundamental operation is a character code addition/subtraction, handled with modulo arithmetic to manage wrap-around within the 16-bit character space (
-
Encryption: Passwords are applied sequentially (Layer 1
$\to$ Layer 2$\to$ ...). -
Decryption: Passwords must be applied in reverse order (Layer
$N \to$ Layer$N-1 \to$ ...), reversing the shift for each layer.
The program enforces a single Master Password format, which contains all necessary keys and the layer count for successful decryption:
layers|password_1|password_2|...|password_N
- .NET SDK (any modern version, e.g., .NET 8).
- Compile: Build the project using the .NET CLI.
dotnet build
- Run: Execute the compiled application (path may vary based on your project structure).
.\bin\Debug\net8.0\Program.exe
- Select Mode: Choose Encrypt (
en). - Configuration: Specify the file path and the number of layers (1-10).
- Key Generation: Enter the First Password (or type
gen-pwd). The application auto-generates keys for subsequent layers. - Master Password Output: Upon completion, the console displays the crucial Master Password. Securely save this string; it is the only way to restore your file.
Encrypt (en) or Decrypt (de)? en
...
Layers (1-10): 3
...
MASTER PASSWORD (SAVE THIS!): 3|MyCustomKey|&d4fP!xZ9kL2|Jm-aH+*rQp(7