Frage

I'm looking for a 100% pure Python implementation of sha512_crypt.c as taken from http://www.akkadia.org/drepper/SHA-crypt.txt.

I'm learning Python. I want to understand the code (and compare it to the C code, etc.). I don't know enough Python to write it myself -- even if I did, I wouldn't trust myself to get it right. I don't have that expertise. So please don't answer this question by telling me to go write the code myself. That's not my question. I am looking for an existing 100% Python implementation that gives the same output as the original sha512_crypt.c written by Ulrich Drepper.

Just to be sure my question is clear, answers I'm looking for are probably either:

  1. "I know for sure that a 100% Python implementation of that C code doesn't exist."

  2. "Here is the link to the Python code that you can download."

(Even though I'm not asking for help writing specific code, I was told to post here as a result of a meta discussion. This question is, after all, about studying Python code.)

BTW, I know there is a Java implementation here: ftp://ftp.arlut.utexas.edu/java_hashes/

I'm looking for the Python equivalent.

Thank you.

UPDATE: james-mills answered the question for me. But today I just learned about Nullege: A Search Engine for Python source code
http://www.nullege.com/ That could come in handy in the future.

I also learned that startpage.com will accept "filetype:py" as a search term and it returns some good results. Unfortunately, I tried the same with duckduckgo and it didn't return any results.

War es hilfreich?

Lösung

Check out passlib it seems to have a pure Python implemtnation of SHA512 crypt that it falls back to:

This class will use the first available of two possible backends: stdlib crypt(), if the host OS supports SHA512-Crypt (most Linux systems). a pure python implementation of SHA512-Crypt built into passlib. You can see which backend is in use by calling the get_backend() method.

Found the source code: https://code.google.com/p/passlib/source/browse/passlib/handlers/sha2_crypt.py

Andere Tipps

Its a bit subjective because you have so many choices, but try this: http://google.com/search?q="sha512_crypt"+filetype:py. Notice the quotes around the filename to ensure you get an exact match (Google will treat the underscore as a space otherwise).

I'm not familiar with Drepper's work or Python, so I could not say if any are any exact matches.

Google search for sha512_crypt

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top