blob: 777f87e7db821c53b14bd4d84c971eb478ac1501 [file] [log] [blame]
Fred Drakef0867311997-12-29 17:31:22 +00001\section{Built-in Module \sectcode{crypt}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-crypt}
Guido van Rossum5c6e3731996-04-10 16:18:20 +00003\bimodindex{crypt}
4
Fred Drakee2f194b1998-02-17 22:24:45 +00005This module implements an interface to the \manpage{crypt}{3} routine,
Guido van Rossum5c6e3731996-04-10 16:18:20 +00006which is a one-way hash function based upon a modified DES algorithm;
Fred Drakef0867311997-12-29 17:31:22 +00007see the \UNIX{} man page for further details. Possible uses include
Guido van Rossum5c6e3731996-04-10 16:18:20 +00008allowing Python scripts to accept typed passwords from the user, or
Fred Drakef0867311997-12-29 17:31:22 +00009attempting to crack \UNIX{} passwords with a dictionary.
Guido van Rossum5c6e3731996-04-10 16:18:20 +000010\index{crypt(3)}
11
Fred Drake19479911998-02-13 06:58:54 +000012\setindexsubitem{(in module crypt)}
Guido van Rossum5c6e3731996-04-10 16:18:20 +000013\begin{funcdesc}{crypt}{word\, salt}
14\var{word} will usually be a user's password. \var{salt} is a
152-character string which will be used to select one of 4096 variations
Fred Drakee2f194b1998-02-17 22:24:45 +000016of DES\indexii{cipher}{DES}. The characters in \var{salt} must be
17either \code{.}, \code{/}, or an alphanumeric character. Returns the
18hashed password as a string, which will be composed of characters from
19the same alphabet as the salt.
Guido van Rossum5c6e3731996-04-10 16:18:20 +000020\end{funcdesc}
21
22The module and documentation were written by Steve Majewski.
23\index{Majewski, Steve}