Giter Club home page Giter Club logo

cryptograph's Introduction

Cryptograph

Hello! This is a cryptographer - a program that can encrypt/decrypt text with the Caesar cipher, as well as break the cipher in 2 ways (frequency and statistical analysis). The program can be launched in 2 ways:

  1. Passing arguments at startup.
  2. Through the desktop application.

Keywords:

  1. jarFile - the path to the jar file
  2. command - a command to launch the program in one of the modes:

-e - encryption,

-d - decryption,

-bf - break the cipher (brute force)

  1. filePath - the path to the main file
  2. additionalFile - the path to the additional file

Features that are available for launch:

  1. Encryption - encrypts the text with the given key.

Template to launch: java -jar jarFile command filePath key

Example: java -jar c:/MyProject/target/myApp.jar -e folder/srcFile .txt 20

Result: Encrypted file marked [ENCRYPTED]

  1. Decryption - decrypts the text with the specified key.

Template to launch: java -jar jarFile command filePath key

Example: java -jar c:/MyProject/target/myApp.jar -d folder/srcFile .txt 20

Result: Encrypted file marked [DECRYPTED]

  1. Brute force - breaks the cipher in two ways:

1). Frequency analysis - tries to find a key to encrypted text

Template to launch: java -jar jarFile command filePath

Example: java -jar c:/MyProject/target/myApp.jar -bf folder/srcFile .txt

The result: an encrypted file in the name of which will be the key with which it was possible to crack the cipher.

Issues: In some cases, it may not display if the text does not match the text validation pattern. For this, you can use the second method.

2). Statistical analysis - uses an additional file to analyze the percentage ratio of characters between two files, and selects a key based on the ratio.

Importantly! The first file you need to specify is the file that needs to be hacked.

Template to launch: java -jar jarFile command filePath additionalFile

Example: java -jar c:/MyProject/target/myApp.jar -bf folder/srcFile .txt folder/additionalFile.txt

The result: an encrypted file in the name of which will be the key with which it was possible to crack the cipher.

Problems: if the text is too small, the key may be incorrectly selected due to low accuracy of calculations.

Recommendations: if one of the methods did not work, try another.

If you do not pass arguments, but only run the program, it will run as a desktop application.

In this application, you can choose one of the launch modes, as well as specify key if the command is -e or -d, or instead of key specify additionalFile if the command is -bf and you use statistical analysis. For frequency analysis, you do not need to specify anything in the key field.

Additional Information:

  1. The cipher uses English and Ukrainian languages, as well as symbols [ . , « » " ' : ! ? ] and a space. Other characters are not encoded.

  2. If the text contains both languages, then the hack will work only for one language, the other language will not be encoded.

  3. Frequency analysis works with a RegEx expression, and compares the decoded string with the expression.

  4. In the statistical analysis, the Map interface is used for the convenience of determining the number of symbols and the percentage ratio.

  5. The Swing library is used for the desktop application.

cryptograph's People

Contributors

y-maxym avatar

Watchers

 avatar

cryptograph's Issues

Review

I would like to express my evaluation of the project based on some important aspects:

The support for two languages is an additional advantage of this project. It is implemented well and allows for effective language detection.

The language detection mechanism works satisfactorily. It is capable of correctly identifying the language of the text with high accuracy.

The use of an enumeration type (enum) to represent languages is a rational approach. It helps maintain understandable and easily modifiable code.

The cryptographic brute-force algorithm (method bruteForce()) using regular expressions is an extraordinary solution that functions effectively. However, it should be noted that this approach may malfunction when adding new languages with different alphabets.

The nested for loop with three levels of nesting is not an optimal solution. There is room for improvement in this algorithm to avoid such a level of nesting. Additionally, it is unclear why the loop condition is specifically i < 100.

The statistical analysis is implemented properly. It provides useful information and results.

All additional tasks have been successfully completed. This deserves praise.

The launch commands do not meet the requirements in the specifications. However, your implementation may even be better.

The letter "Ґ" is missing from the Ukrainian alphabet.

Overall, the project works well and fulfils its core functions.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.