Ditched '_find_SET()', since it was a no-value-added wrapper around
[python/dscho.git] / Modules / cryptmodule.c
blob746dee15928754a737f184b4441a7372616af72d
1 /* cryptmodule.c - by Steve Majewski
2 */
4 #include "Python.h"
6 #include <sys/types.h>
9 /* Module crypt */
12 static PyObject *crypt_crypt(self, args)
13 PyObject *self, *args;
15 char *word, *salt;
16 extern char * crypt();
18 if (!PyArg_Parse(args, "(ss)", &word, &salt)) {
19 return NULL;
21 return PyString_FromString( crypt( word, salt ) );
25 static char crypt_crypt__doc__[] = "\
26 crypt(word, salt) -> string\n\
27 word will usually be a user's password. salt is a 2-character string\n\
28 which will be used to select one of 4096 variations of DES. The characters\n\
29 in salt must be either \".\", \"/\", or an alphanumeric character. Returns\n\
30 the hashed password as a string, which will be composed of characters from\n\
31 the same alphabet as the salt.";
34 static PyMethodDef crypt_methods[] = {
35 {"crypt", crypt_crypt, 0, crypt_crypt__doc__},
36 {NULL, NULL} /* sentinel */
39 DL_EXPORT(void)
40 initcrypt()
42 Py_InitModule("crypt", crypt_methods);