Coder Social home page Coder Social logo

python-sha1's Introduction

python-sha1

Test

An implementation of the SHA-1 algorithm in Python, following the Federal Information Processing Standards Publication 180-4 (FIPS 180-4) specification sheet.

Motivation

As students in COSC483: Applied Cryptography at the University of Tennessee Knoxville, we were tasked with implementing a modified version of the SHA-1 algorithm in any programming language of our choice. This modified SHA-1 implementation would allow users to start in the middle of a SHA-1 hashing operation given a previous intermediate value. This functionality allows adversaries to carry out a length extension attack. Therefore, using our SHA-1 implementation, we were then tasked with carrying out such an attack in a simulated environment.

How to Hash

This program requires Python3. It was specifically tested with Python v3.9.0.

To hash a given string, run the command:

> python sha.py mystring

To observe the intermediate values for each round of SHA-1, enable verbose logging:

> python sha.py -v mystring

How to Perform MAC Attack

Given a message No one has completed Project #3 so give them all a 0. and its accompanying MAC d907cdfc9f6107b8180ef703517944280478f178, you can perform the length extension attack with the following command:

> python attack.py --mac d907cdfc9f6107b8180ef703517944280478f178 "No one has completed Project #3 so give them all a 0." "P.S. Except for Joey Lemon, go ahead and give him the full points."

How to Test

This program is accompanied by a suite of unit tests designed to ensure the correct functionality of every routine involved in the SHA-1 algorithm. To execute the unit tests, run the command:

> python -m unittest

python-sha1's People

Contributors

joeylemon avatar

Watchers

 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.