Giter VIP home page Giter VIP logo

vigenere-cipher-breaker's Introduction

Vigenère cipher breaker

A C++ implementation of Practical Cryptography's Vigenère cipher breaker for improved speed, along with my own additions and features. More information about the algorithm that the program uses to break the Vigenère cipher can be found here and here.

More information on the Vigenère cipher itself can be found here

Running the program

UNIX

To run the program in a UNIX environment with the provided Makefile, ensure that GCC is installed, so that the source code files can be compiled. This can be checked by running the following command:

gcc --version

If GCC is installed, there will be a message like the following (with the version indicated):

gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

To compile the program, navigate to the directory where the files are saved and execute the following command:

make

This will execute the following commands, leading to the compiled program:

g++-11 -c vigenereCipherBreaker.cpp -std=c++17 -O2 -Wextra
g++-11 -c nGramScorer.cpp -std=c++17 -O2 -Wextra
g++-11 -c vigenereCipher.cpp -std=c++17 -O2 -Wextra
g++-11 -o vigenereCipherBreaker vigenereCipherBreaker.o nGramScorer.o vigenereCipher.o -lpthread -O2 -Wextra

To run the program, use the following syntax:

./vigenereCipherBreaker [ciphertext] [min keylength] [max keylength] [verbosemode]

The ciphertext command-line argument should be a string surrounded by double-quotes.
The key lengths should be integer values.
Verbose mode should be given a value of 1 or 0 to indicate true or false, respectively.

Windows

It is recommended to use the Windows Subsystem for Linux (WSL) to run the program on a Windows machine.
The Microsoft website has documentation on how to do this.
Once WSL has been set up, the instructions provided for UNIX can be followed to run the program.

Example Runs

The following are a few examples of what running the program is like:

Verbose mode off:



Verbose mode on:

Reliability of Key Cracking

Depending on the length of the ciphertext, length of the encryption key, and the textual properties of the encrypted message, the program will not always be successful. Since the program utilizes statistics to determine the probability that a particular key is the right one, certain criteria have to be met to ensure reliability (e.g. a small key-length to ciphertext length ratio). A significant weakness of the Vigenère cipher is the repeating occurrence of the key throughout the text. Higher repetitions have a higher chance of being cracked. The program should be effective and successful most of the time if the key is at most 25% the length of the ciphertext (without spaces, punctuation, and other non-alphabetic characters).

vigenere-cipher-breaker's People

Contributors

zehadialam avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ziloka

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.