py5实现sha512_crypt.c [英] Python implementation of sha512_crypt.c

查看:257
本文介绍了py5实现sha512_crypt.c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个100%的纯Python执行sha512_crypt.c,来自 http://www.akkadia.org/drepper/SHA-crypt.txt



我正在学习Python。我想理解代码(并将其与C代码进行比较,等等)。我不知道足够的Python来自己写 - 即使我这样做,我不会相信自己,得到它的权利。我没有这方面的专业知识。所以请不要回答这个问题,告诉我自己写代码。这不是我的问题。我正在寻找一个现有的 100%的Python实现,它提供与由Ulrich Drepper撰写的原始sha512_crypt.c。



只是为了确保我的问题清楚,我正在寻找的答案可能是:


  1. 我确定该C代码的100%Python实现不存在。


  2. 这是指向您可以下载的Python代码的链接。



b $ b

(虽然我不是在写特定的代码,但是我被要求在这里发表的讨论的结果,这个问题是,毕竟,学习Python代码。)



BTW,我知道这里有一个Java实现: ftp ://ftp.arlut.utexas.edu/java_hashes/



我在寻找与Python等效的。



谢谢。



更新: james-磨坊回答了我的问题。但今天我刚刚了解了Nullege:用于Python源代码的搜索引擎

http:// www。 nullege.com/
这可能会在将来派上用场。



我还了解到startpage.com会接受filetype:py作为搜索字词,并返回一些好的结果。不幸的是,我尝试了与duckduckgo相同,并没有返回任何结果。

解决方案

签出 passlib 它似乎有一个纯粹的Python实现 SHA512 crypt ,它会回到:


这个类将使用第一个可能的两个后端:
stdlib crypt (),如果主机操作系统支持SHA512-Crypt(大多数Linux系统)。
一个纯python实现的SHA512-Crypt内置到passlib。
您可以通过调用get_backend()方法查看正在使用的后端。


找到源代码: https://code.google.com/p/passlib/source /browse/passlib/handlers/sha2_crypt.py


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.

解决方案

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

这篇关于py5实现sha512_crypt.c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆