Skip to content

SHA-256 implemented in python using arrays of integers representing individual bits

Notifications You must be signed in to change notification settings

YaBoiBreezy/python-sha-256-integer-arrays

Repository files navigation

SHA-256 in python with arrays of ints

SHA-256 implemented in python using arrays of integers representing individual bits [1,0,0,1,1,0,0,0]
When implemented with bitwise operations, SHA-256 is difficult to visualize and alter
The purpose of this project was to implement SHA-256 in a way that allows people to actually interact with it
This project uses an integer in an array for each individual bit, allowing all the data and logic to be clearly seen

Getting Started

There are 3 files:

  • SHA-256.py takes a string input and runs a compression loop on it before parsing, like normal SHA-256.
  • SHA-256-BASIC.py takes a formatted input (array of length 512, containing only 1 and 0), which should be sufficient for cryptocurrency applications.
  • SHA-256-PROBABILITIES.py is like SHA-256.py, but runs probabilistically, so bits can have partial values such as 0.67, aka "67% chance of being 1". Sadly its intended purpose (a method of breaking SHA-256 by predicting hashes to efficiently search inputs and tend towards a collision) doesn't work, so it is effectively just a slightly slower version of SHA-256.py
  • Prerequisites

    There are no dependencies. It works on windows.

    Built With

    notepad and powershell 😎
    I'm not kidding. Thanks university for teaching me good habits

    Contributing

    It's basically done, if you want to help feel free to push whatever

    Authors

    License

    Anyone can use it

    Acknowledgments

    Big thanks to this blog for giving a step by step walkthrough, troubleshooting would have been even more horrible without it:
    https://blog.boot.dev/cryptography/how-sha-2-works-step-by-step-sha-256/

About

SHA-256 implemented in python using arrays of integers representing individual bits

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages