SHA256 hash in Python 2.4

Is there a way to calculate the SHA256 hash in Python 2.4? (I emphasize: Python 2.4) I know how to do this in Python 2.5, but unfortunately it is not available on my server and the update will fail. I have the same problem as the guy in this question, but using Python 2.4. Any help would be greatly appreciated.

EDIT: Sorry, I mean SHA 256. I was in a hurry too. Sorry again.

+7
python sha256
source share
3 answers

Yes, you can. With Python 2.4, there was a SHA-1 module that does just that. See the documentation .

However, keep in mind that importing code from this module will result in DeprecationWarnings errors when starting with newer Python.

Well, since the requirement was drawn out as SHA-256, using the SHA-1 module in the standard library is not enough. I suggest checking out pycrypto , it has an SHA-256 implementation. There are also binary versions of windows to match old Pythons, follow the links from Andrew Kuchlings to the old PyCrypto page .

+10
source share

You can use the sha module, if you want to remain compatible, you can import it as follows:

 try: from hashlib import sha1 except ImportError: from sha import sha as sha1 
+8
source share

There is a version with backsted hashlib support at http://pypi.python.org/pypi/hashlib , and I just transferred the new version of hmac and put it on http://pypi.python.org/pypi/hmac

+4
source share

All Articles