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.

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 6 Years Ago 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 article has been dead for over six months. Start a new discussion instead.