Giter Club home page Giter Club logo

a5-1-in-python's Introduction

A5-1-in-Python

A5/1 Implementation in Python for CS 166 (Cryptography) at SJSU

This was an implementation for one of the Extra Credit assignments for CS 166. It's a crude cli implementation of the hardware-based A5/1 stream cipher.

It does a few things:

  1. Processes a source string to encrypt with a binary key with a length of 64 bits.
  2. Splits and assigns the key into 3 registers: 19, 22, and 23 bits in length.
  3. Converts the plaintext string parameter into raw binary data.
  4. Generates a keystream with the same length as the input plaintext binary.
  5. Produces the ciphertext with the use of XOR.

It will do this both to encrypt the data and decrypt it, and compares the resulting plaintext with the initial input.

Running run.bat should give you the output (or something similar, if you altered the input file):

C:\Path\To\Dir>py -3 a51.py abc 0111110101101101110111011011110111001100101101001111001101100110
Encrypting...
Unprocessed Arguments
Key:  0111110101101101110111011011110111001100101101001111001101100110
Plaintext:  abc
Processing...
Processing complete.
Assigning Keys to Registers...
X:  0111110101101101110
Y:  1110110111101110011001
Z:  01101001111001101100110
Keystream:  000100111000110001000001
Plaintext:  011000010110001001100011
Binary Ciphertext:  011100101110111000100010
24
Normal Ciphertext:  rî"

Testing Results...
Unprocessed Arguments
Key:  0111110101101101110111011011110111001100101101001111001101100110
Plaintext:  rî"
Processing...
Processing complete.
Assigning Keys to Registers...
X:  0111110101101101110
Y:  1110110111101110011001
Z:  01101001111001101100110
Keystream:  000100111000110001000001
Plaintext:  011100101110111000100010
Binary Ciphertext:  011000010110001001100011
24
Normal Ciphertext:  abc

Test Result:  True

a5-1-in-python's People

Contributors

stephenkairos avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Erick Mena avatar Abraham Kong avatar

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.