Giter VIP home page Giter VIP logo

cryptoanalysis's Introduction

Cryptoanalysis

Applied Cryptography Project

Who worked on this project?

Patrick Whitsell ([email protected])
Casey McGinely ([email protected])
Fernando Maymi ([email protected])

Objective

  1. Given a set of known plaintexts and a ciphertext, can we determine which plaintext was encrypted? (known plaintext attack)
  2. Given a set of random ciphertexts, can we reliably decrypt to the plaintext? (known ciphertext attack)

The encryption algorithm for both tasks is known beforehand. Can we find a suffiecient vulnerability in the scheme, such that we can decrypt ciphertexts on demand?

Known Plaintext Attack

  • Ciphertexts are 500 characters each
  • Whitespace is unencrypted. Ciphertext whitespace == plaintext whitespace.
  • Sets of plaintexts are known

Strategy

  1. Compare number of words (Majority of plaintexts fail here)
  2. Compare lengths of words
  3. For each known plaintext, create key mapping letter-by-letter until a contradiciton is found or the entire key mapping is complete. (Almost all plaintext are already eliminated)

Basic Analysis

A little bit of quick statistics will show us that the most likely length (eight) consists of about 1/5 of words in the provided word list. Assuming the plaintext is five words (L = 40, much less than the L=500 in the actual problem) we find that we have a 1/3125 chance of getting a plaintext that consists of five eight-letter words. (It is important to note that this is the most likely result since eight-letter words are independently the most likely word length and the plaintext is randomly selected.) This means that the chance of any random, five word ciphertext matching an unrelated plaintext in word length pattern is no more than 0.032%. This means very few ciphertexts will progress to the attempted key mapping stage. This makes the approach very efficient, since it quickly eliminates possible plaintexts with use of only integer comparisons and counting. Furthermore, the longer the ciphertext the larger the plaintext space needs to be to render this approach insufficient on its own.

In general with this strategy, plaintexts with larger lengths is an easier problem than shorter plaintext lengths because of the lower probability of progressing to the key mapping stage. Likewise, a smaller set of plaintexts is an easier task than larger plaintext sets because less plaintexts will progress to the key mapping stage.

Known Ciphertext Attack

  • Ciphertexts are 500 characters each
  • Whitespace is unencrypted. Ciphertext whitespace == plaintext whitespace.
  • Sets of plaintexts are unknown

Strategy

  • Depth first search of an undirected acyclic graph, continuously pruned into a linked list as the search progresses.
  • Dictionary of english words sorted int 'buckets' by length. Word 'buckets' sorted by agrigate letter frequency
  • Longest words are guessed first. In general, fewer longer words are in the dictionary. Also longer words fill up more key mappings, reducing the next guess space more quickly.

Basic Analysis

A resonable decryption speed was acheived most of the time. Problem arose if there were no 'long' words to guess first. The longest word, which was actually fairly short, would be guessed first, fill in small key mapping, and would take a very long time to brute force the word space.

Another issue was that the program would mistakenly decrypt very short words. This was happening because the key mapping coincidentally would not create a contradiction before the whole plaintext was guessed. Example: 'red' was guessed instead of 'req'. In this example our letter frequency sorting strategy was working against us.

Despite a few problems, this strategy was very successful. In testing our program was able decrypt 94.5% of the ciphertexts' letters correctly.

cryptoanalysis's People

Contributors

pwhits avatar cmcg513 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

cmcg513

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.