8.4 crypt -- Function used to check Unix passwords

Availability: Unix.

This module implements an interface to the crypt(3) routine, which is a one-way hash function based upon a modified DES algorithm; see the Unix man page for further details. Possible uses include allowing Python scripts to accept typed passwords from the user, or attempting to crack Unix passwords with a dictionary.

crypt (word, salt)
word will usually be a user's password. salt is a 2-character string which will be used to select one of 4096 variations of DES. The characters in salt must be either ".", "/", or an alphanumeric character. Returns the hashed password as a string, which will be composed of characters from the same alphabet as the salt.

The module and documentation were written by Steve Majewski.


Send comments on this document to python-docs@python.org.


Banner.Novgorod.Ru