TrevorPeyton
TrevorPeyton

Reputation: 659

Python 3.3 can't import Crypt

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'

Upvotes: 4

Views: 7990

Answers (2)

Cairnarvon
Cairnarvon

Reputation: 27752

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?

Upvotes: 4

casevh
casevh

Reputation: 11394

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.

Upvotes: 9

Related Questions