Back to index

python3.2  3.2.2
Functions | Variables
cryptmodule.c File Reference
#include "Python.h"
#include <sys/types.h>

Go to the source code of this file.

Functions

static PyObjectcrypt_crypt (PyObject *self, PyObject *args)
 PyDoc_STRVAR (crypt_crypt__doc__,"crypt(word, salt) -> string\n\ word will usually be a user's password. salt is a 2-character string\n\ which will be used to select one of 4096 variations of DES. The characters\n\ in salt must be either \".\", \"/\", or an alphanumeric character. Returns\n\ the hashed password as a string, which will be composed of characters from\n\ the same alphabet as the salt.")
PyMODINIT_FUNC PyInit_crypt (void)

Variables

static PyMethodDef crypt_methods []
static struct PyModuleDef

Function Documentation

static PyObject* crypt_crypt ( PyObject self,
PyObject args 
) [static]

Definition at line 15 of file cryptmodule.c.

{
    char *word, *salt;
#ifndef __VMS
    extern char * crypt(const char *, const char *);
#endif

    if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) {
        return NULL;
    }
    /* On some platforms (AtheOS) crypt returns NULL for an invalid
       salt. Return None in that case. XXX Maybe raise an exception?  */
    return Py_BuildValue("s", crypt(word, salt));

}

Here is the call graph for this function:

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

Definition at line 59 of file cryptmodule.c.

{
    return PyModule_Create(&cryptmodule);
}

Variable Documentation

Initial value:
 {
    {"crypt",           crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
    {NULL,              NULL}           
}

Definition at line 40 of file cryptmodule.c.

struct PyModuleDef [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "crypt",
    NULL,
    -1,
    crypt_methods,
    NULL,
    NULL,
    NULL,
    NULL
}

Definition at line 46 of file cryptmodule.c.