Fred Drake | f086731 | 1997-12-29 17:31:22 +0000 | [diff] [blame] | 1 | \section{Built-in Module \sectcode{crypt}} |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 2 | \label{module-crypt} |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 3 | \bimodindex{crypt} |
| 4 | |
Fred Drake | e2f194b | 1998-02-17 22:24:45 +0000 | [diff] [blame] | 5 | This module implements an interface to the \manpage{crypt}{3} routine, |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 6 | which is a one-way hash function based upon a modified DES algorithm; |
Fred Drake | f086731 | 1997-12-29 17:31:22 +0000 | [diff] [blame] | 7 | see the \UNIX{} man page for further details. Possible uses include |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 8 | allowing Python scripts to accept typed passwords from the user, or |
Fred Drake | f086731 | 1997-12-29 17:31:22 +0000 | [diff] [blame] | 9 | attempting to crack \UNIX{} passwords with a dictionary. |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 10 | \index{crypt(3)} |
| 11 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 12 | \begin{funcdesc}{crypt}{word, salt} |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 13 | \var{word} will usually be a user's password. \var{salt} is a |
| 14 | 2-character string which will be used to select one of 4096 variations |
Fred Drake | e2f194b | 1998-02-17 22:24:45 +0000 | [diff] [blame] | 15 | of DES\indexii{cipher}{DES}. The characters in \var{salt} must be |
| 16 | either \code{.}, \code{/}, or an alphanumeric character. Returns the |
| 17 | hashed password as a string, which will be composed of characters from |
| 18 | the same alphabet as the salt. |
Guido van Rossum | 5c6e373 | 1996-04-10 16:18:20 +0000 | [diff] [blame] | 19 | \end{funcdesc} |
| 20 | |
| 21 | The module and documentation were written by Steve Majewski. |
| 22 | \index{Majewski, Steve} |