I have just started python as after a chat with a friend I have discovered it would be the most suitable language for my latest project. The problem I have come across is I need a sha1 function written in python. I don't want to use the built in hashlib but I need an open source algorithm that I can modify. Can anybody help me on this one as google shows me nothing in the way of code snippets. Also I tried recreating the algorithm from scratch but turned out terribly hard to convert c++ code to python.

6 Years
Discussion Span
Last Post by cwarn23

You could try to convert the C code from the files shamodule.c, sha256module.c and sha512module.c in the python source distribution, which provide the sha algorithms for the hashlib module.

Edited by Gribouillis: n/a


You can actually bind C and C++ libraries to python, that way you wouldn't need to re-write the code, and would still get the efficiency of the original library.

Well I need to be able to make constant changes to the library without having to recompile the library. Nice idea but not for this situation.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.