Caesar Cipher is an algorithm that shifts symbols of input data by user defined offset.
This command line tool provides capability to shift bytes in ranges [65, 90] and [97, 122] of provided input (file and standard input are both supported) and write it to user defined output (can be either standard output or a file).
- .NET 5
- Both of the listed IDEs have been confirmed to work:
- Microsoft Visual Studio 2019
- JetBrains Rider
Refer to: Unit Testing Result README.md
Command line interface only accepts either 1 or 3 commands - help or {shift} {input} {output} where:
helpprovides usage instructions.{shift}is a number in range [1, 25] by which to offset bytes of provided input.{input}is either a file path or standard input marked by "-".{output}is either a file path or standard output marked by "-".
{output} file already exists - it will rewritten!
To decrypt previously encrypted data - calculate 26 - {shift} and use value in place of {shift}.
For example if data was encrypted with {shift} of 5 - it can be decrypted with 21 as 26 - 5 = 21.
-
echo Hello World! | CaesarCipher 5 - -which results inMjqqt Btwqi!.Passing said output into the tool again with decryption
{shift}like so:echo Hello World! | CaesarCipher 5 - - | CaesarCipher 21 - -Results in
Hello World!. -
For example file
data.txtin the same directory as the executable contains:The quick brown fox jumps over the lazy dog.Running it through the tool:
CaesarCipher 7 data.txt encrypted.txtWill create a file
encrypted.txtin the same directory as executable with obviously garbled content:Aol xbpjr iyvdu mve qbtwz vcly aol shgf kvn.Running encrypted file through the tool with decryption
{shift}like so:CaesarCipher 19 encrypted.txt decrypted.txtWill result in file
decrypted.txtwith content:The quick brown fox jumps over the lazy dog. -
CaesarCipher 7 data.txt -results inAol xbpjr iyvdu mve qbtwz vcly aol shgf kvn.Piping said output through
CaesarCipher 7 data.txt - | CaesarCipher 19 - -will result in:The quick brown fox jumps over the lazy dog.Using
CaesarCipher 7 data.txt - | CaesarCipher 19 - copy.txtwill result in filecopy.txtwith content:The quick brown fox jumps over the lazy dog.
{output}files are overwritten.- Launching tool with input method as standard input like so
CaesarCipher 5 - -and then not providing said input will result in application waiting. Forever, if necessary.