When I type in import Crypt on the command line it says:
>>>import crypt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\crypt.py", line 3, in <module>
import _crypt
ImportError: No module named '_crypt'
The crypt
module is an interface to the Unix crypt
library which is used for encrypting Unix passwords. It is documented as not being available on Windows. It is not a general purpose cryptography library.
If all you're looking for is an implementation of crypt(3)
, I've knocked up a pure-Python implementation here, ported from this public domain C implementation. It's pretty damn slow (about 2800 times slower than Python's built-in crypt
on my machine, which is already about half the speed of OpenSSL's DES_crypt
), but if you're just calculating the occasional hash, that shouldn't really be a problem.
Are you writing an imageboard, by any chance?
来源:https://stackoverflow.com/questions/15181739/python-3-3-cant-import-crypt