pythonshahashlib

Python SHA to hashlib


I am updating some old code and there are a lot of the long depreciated sha module calls such as:

sha.new(borne.mark).digest()[:4]

and many others among the code.

Since I am converting it to modern code, I want to assure compatibility, while using the hashlib package, but I'm not sure which sha to use, as the oldest documentation is already too recent and does not mention the older version. Is the one to use just hashlib.sha1()?

I have spotted several potential sha to use from hashlib but I'm not sure which one to use to match the former sha lib.


Solution

  • It appears the algorithm used is sha1. Source: python 2.5 documentation