GithubHelp home page GithubHelp logo

theteacat / com2108-assignment-3 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 14 KB

An assignment @ The University of Sheffield to implement the Bombe in Haskell

Haskell 100.00%
university-of-sheffield haskell cryptography enigma enigma-machine enigma-simulator enigma-cipher

com2108-assignment-3's Introduction

COM2108-Assignment-3

This was an assignment to implement the Bombe in Haskell, given some constraints. Assignment 2 (Enigma.hs) is also included in this repository as it is a dependency for assignment 3.

Part of this assignment was an extension for which there were some suggestions, but we were free to go beyond. Extension.hs is an extended version of Bombe.hs, a description of the changes can be found in report.md, but in summary it is parallelised.

Setup

Enigma.hs and Bombe.hs should run happily in GHCi.

Extension.hs has a dependency and needs to be compiled to take advantage of the parallelisation.

  • Install dependencies:

    cabal update
    cabal install parallel
    
  • Compile:

    ghc Extension.hs -threaded
    
  • Run:

    ./Extension +RTS -N{x}
    

    Replace {x} with the number of threads you wish to utilise.

Extension.hs Default Setup

Extension.hs is set up by default to decode the following message:

YZCSDCVUFVJAAEMVILWRVSQZFCBPJFVYHUUPHLAPJMTMFNLURRADJFCBRBXBCUSSXVYWAPQIRCUVVNODKELDMNNQHYFEFOZPBUIPWKPXIYPKQHMVOAVXFVDCKMZOULMTQNUFBVHFUSXYCYPWFKBYW

Assuming:

  • The crib is COMPUTERSCIENCESHEFFIELDUNIVERSITYSTOP
  • The left rotor is EKMFLGDQVZNTOWYHXUSPAIBRCJ
  • The middle rotor is AJDKSIRUXBLHWTMCQGZNPYFVOE
  • The right rotor is BDFHJLCPRTXVZNYEIWGAKMUSQO
  • The reflector is paired as follows: [('A','Y'),('B','R'),('C','U'),('D','H'),('E','Q'),('F','S'),('G','L'),('I','P'),('J','X'),('K','N'),('M','O'),('T','Z'),('V','W')]

You can change all of this in the definition of main.

It should decode to:

COMPUTERSCIENCESHEFFIELDUNIVERSITYSTOPENIGMAMACHINESAREINTERESTINGBUTTHOSECODEBREAKERSWHOCRACKEDTHECODEMUSTHAVEBEENGENIUSESTODOSOWITHOUTCOMPUTERSSTOP

With offsets (4,3,7) of the left, middle and right rotors respectively, and a steckerboard equivalent to:

[('T','T'),('K','C'),('N','E'),('O','M'),('V','V'),('P','P'),('S','S'),('J','U'),('X','F'),('G','R'),('L','D'),('B','Z')]

com2108-assignment-3's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

milan-sm

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.