blob: 418b9d5006c72a6f08bef1d1a4238fbe4ca4be71 [file] [log] [blame]
Fred Drake3a0351c1998-04-04 07:23:21 +00001\section{Built-in Module \module{crypt}}
Fred Drakeb91e9341998-07-23 17:59:49 +00002\declaremodule{builtin}{crypt}
3
4\modulesynopsis{The \cfunction{crypt()} function used to check \UNIX{} passwords.}
5
Guido van Rossum5c6e3731996-04-10 16:18:20 +00006
Fred Drakee2f194b1998-02-17 22:24:45 +00007This module implements an interface to the \manpage{crypt}{3} routine,
Guido van Rossum5c6e3731996-04-10 16:18:20 +00008which is a one-way hash function based upon a modified DES algorithm;
Fred Drakef0867311997-12-29 17:31:22 +00009see the \UNIX{} man page for further details. Possible uses include
Guido van Rossum5c6e3731996-04-10 16:18:20 +000010allowing Python scripts to accept typed passwords from the user, or
Fred Drakef0867311997-12-29 17:31:22 +000011attempting to crack \UNIX{} passwords with a dictionary.
Guido van Rossum5c6e3731996-04-10 16:18:20 +000012\index{crypt(3)}
13
Fred Drakecce10901998-03-17 06:33:25 +000014\begin{funcdesc}{crypt}{word, salt}
Guido van Rossum5c6e3731996-04-10 16:18:20 +000015\var{word} will usually be a user's password. \var{salt} is a
162-character string which will be used to select one of 4096 variations
Fred Drakee2f194b1998-02-17 22:24:45 +000017of DES\indexii{cipher}{DES}. The characters in \var{salt} must be
18either \code{.}, \code{/}, or an alphanumeric character. Returns the
19hashed password as a string, which will be composed of characters from
20the same alphabet as the salt.
Guido van Rossum5c6e3731996-04-10 16:18:20 +000021\end{funcdesc}
22
23The module and documentation were written by Steve Majewski.
24\index{Majewski, Steve}