2015-04-03 17:53:51 -03:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
PyDoc_STRVAR(crypt_crypt__doc__,
|
|
|
|
"crypt($module, word, salt, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Hash a *word* with the given *salt* and return the hashed password.\n"
|
|
|
|
"\n"
|
|
|
|
"*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n"
|
|
|
|
"character string, possibly prefixed with $digit$ to indicate the method)\n"
|
|
|
|
"will be used to perturb the encryption algorithm and produce distinct\n"
|
|
|
|
"results for a given *word*.");
|
|
|
|
|
|
|
|
#define CRYPT_CRYPT_METHODDEF \
|
|
|
|
{"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
crypt_crypt_impl(PyObject *module, const char *word, const char *salt);
|
2015-04-03 17:53:51 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
crypt_crypt(PyObject *module, PyObject *args)
|
2015-04-03 17:53:51 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *word;
|
|
|
|
const char *salt;
|
|
|
|
|
2015-04-23 18:40:51 -03:00
|
|
|
if (!PyArg_ParseTuple(args, "ss:crypt",
|
2016-06-09 10:16:06 -03:00
|
|
|
&word, &salt)) {
|
2015-04-03 17:53:51 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-04-03 17:53:51 -03:00
|
|
|
return_value = crypt_crypt_impl(module, word, salt);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
2016-07-07 12:20:03 -03:00
|
|
|
/*[clinic end generated code: output=8dfc88264e662df4 input=a9049054013a1b77]*/
|