[Tutor] sha-256 without using hashlib

Dave Angel davea at davea.name
Fri Apr 26 11:56:44 CEST 2013


On 04/26/2013 05:08 AM, Arijit Ukil wrote:
> I like to implement sha-256 without using implement. It is easy using
> hashlib as:
>
> import hashlib
> m = hashlib.sha256()
> m.update("hi")
> print m.hexdigest()
>
> If anybody has pointer on sha-256 implemented without using hashlib
> library, please share.
>

If you'd tell us WHY you don't want to use a stdlib, we might be able to 
help.

For example, perhaps you're supposed to code it for an assignment, and 
show that you understand the algorithms.  In that case, look up the 
algorithm on the net, and start from there.

    http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf

Or you could be assuming that you can do a better, faster or whatever 
job than the library.  In that case, consider using numpy, or Cython, or 
a C compiler.

Or perhaps you didn't realize you could get the sources to hashlib 
online.  I believe some are in Python, and some in C, so that might not 
help you if your goal is one of the previous ones.


-- 
DaveA


More information about the Tutor mailing list