SHA-256 implementation in Python

runeks picture runeks · Sep 6, 2011 · Viewed 29.9k times · Source

I'm looking for a Python implementation of the SHA-256 hash function. I want to use it to get a better understanding of how the SHA-256 function works, and I think Python is the ideal language for this. Pseudo-code has the limitation that I can't run/test it, to see what my modifications of the code do to the output.

Answer

Eli Collins picture Eli Collins · Sep 6, 2011

PyPy's source contains a pure-python implementation of SHA-256 here. Poking around in that directory, you'll probably also find pure-python implementations of other standard hashes.