Code Monkey home page Code Monkey logo

mtp_breaker's Introduction

MTP Breaker Logo

Multiple-Time Pad Breaker

Reveals messages that were encrypted using the one-time pad scheme with the same key.

Other MTP breaker programs on GitHub use the decryption technique explained here. This technique works when there are many ciphertexts and space characters in the plaintexts do not align. Also, in most cases, this technique offers partial decryption only. Thus, another program is needed to fill in the gaps.

OTP Breaker approaches the problem from a different angle. Rather than treating the ciphertexts as a list of characters and trying to find certain characters inside them, OTP Breaker assumes that the ciphertexts follow a certain structure, like sentences in a language do, and tries to build meaningful plaintexts from the ciphertexts.

Inputs:

  • a set of N (>1) ciphertexts.
  • a list of characters that the ciphertexts can contain. The default is abcdefghijklmnopqrstuvwxyz .
  • a list of words (i.e. non-space character sequences delimited by space ( ) characters) that the plaintexts are allowed to contain.

Output:

  • a list of N-tuples each of which contain a valid decryption of the ciphertexts.

the ciphertexts follow a certain structure, like having a space character between words.

Usage

$ python mtp_breaker.py -h
usage: mtp_breaker.py [-h] [-ch CHARACTERS] -c CIPHERTEXTS -w WORDS [-o OUTPUT]

optional arguments:
  -h, --help            show this help message and exit
  -ch CHARACTERS, --characters CHARACTERS
                        file containing the characters that allowed to be in the plaintext. all
                        characters in the 1. line
  -c CIPHERTEXTS, --ciphertexts CIPHERTEXTS
                        file containing the ciphertexts. 1 ciphertext per line
  -w WORDS, --words WORDS
                        file containing the words that allowed to be in the plaintexts. 1 word per line
  -o OUTPUT, --output OUTPUT
                        output file

Checklist

Code

  • Break with 2 encryptions
  • Break with >2 encryptions
  • Take long word lists as input
  • Accept non-alphabetic and/or incomplete endings
  • Output keys that work
  • Terminate gracefully if no solution was found
  • Accept numbers in the plaintext
  • Accept punctuation in the plaintext
  • Handle ciphertexts of different lengths
  • More efficient trie traversal algorithm
  • Testing suite

User Interactions

  • Logo
  • CLI
  • Stats
  • Read ciphertexts from file
  • Write keys and plaintexts to file
  • Progress bar
  • Ciphertext format warnings
    • Partial one-time pad
  • Turkish README.md

Acknowledgements

The current code uses a Trie from Tutorialspoint.

For the logo, the template called "Blue and Red Shop Free Delivery Shadow Text Effect" by "Canva Creative Studio" was used.

CLI logo made at patorjk.com. Font: Calvin S.

mtp_breaker's People

Contributors

kilyig avatar

Watchers

 avatar

mtp_breaker's Issues

Long word lists cause exception

Long files like this give the following error:

Traceback (most recent call last):
  File "otp_decrypter.py", line 73, in <module>
    if not checker.is_valid_prefix(curr_prefix + next_chars[ctext]):
  File "[path]/otp_phrase_checker.py", line 11, in is_valid_prefix
    return self._trie.starts_with(prefix)
  File "[path]/Trie.py", line 25, in starts_with
    if l not in current:
TypeError: argument of type 'int' is not iterable

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.