This project is an encryption/decryption app that can process the source using following ciphers:
- Caesar
- Vigenere
- Affine
- Gamma
- Feistel network
Note: All source characters will be converted to the upper case before further processing.
Each source character which is not English letter will be skipped.
These two statements are true for everything excluding Feistel network cipher.
Also, this app can try to break Vigenere cipher using the frequency cryptanalysis.
Note: the probability of the successful breaking is directly proportional to the similarity of the source to the "normal" English text ("normal" means "written using a common English language").
- add tests for all ciphers
An Affine cipher's a
variable is hardcoded in the current version of app.
It's value is:
3
for encryption9
for decryption
Gamma cipher's a
, b
, m
variables are hardcoded in the current version of app.
Their values are:
a = 3
b = 2
m = 40692
Feistel network's keys and the round key calculation algorithm are hardcoded in the current version of app.
Their values are:
- keys:
5
,2
,7
,6
,1
,8
,3
,9
,4
,6
,2
,3
,8
,5
,1
,4
- the round key calculation algorithm:
key * 7 / 2
(an integer division)
The program works with texts which are encoded using UTF-8, so Feistel network's block size equals 4.
Note: The program theoretically can fail while processing a text which contains some UTF-8 characters.
At the moment there's no workaround or fix for this issue.
- Kotlin
- Gradle
- Install OpenJDK (≥ 17), GNU Make
- Run
make
- Run
java -jar ./build/cryptographer.jar
with--help
or some another CLI args
--encrypt
,--decrypt
,--break
- the name of an action to do--caesar
,--vigenere
,--affine
,--gamma
,--feistelNetwork
- the name of the cipher to use--in IN
,--input IN
- an input file path--out OUT
,--output OUT
- an output file path
--shift SHIFT
- the shift required for the Caesar cipher encryption/decryption--key KEY
- the key required for the Vigenere cipher encryption/decryption (must consist of English letters only)--b B
-b
variable required for the Affine cipher encryption/decryption
--startKey START_KEY
- the start key for the gamma cipher encryption/decryption (defaults to1
)-h
,--help
- show this help message and exit
java -jar ./build/cryptographer.jar --encrypt --gamma --startKey 25 --in src.txt --out dest.txt