blob: 7cc03bed28ffa4ab730c0b4399c90959dd590bc8 [file] [log] [blame]
Guido van Rossume4c61311994-05-06 14:25:39 +00001/* cryptmodule.c - by Steve Majewski
2 */
3
Roger E. Masse56c345b1996-12-09 23:14:26 +00004#include "Python.h"
Guido van Rossume4c61311994-05-06 14:25:39 +00005
6#include <sys/types.h>
7
8
9/* Module crypt */
10
11
Roger E. Masse56c345b1996-12-09 23:14:26 +000012static PyObject *crypt_crypt(self, args)
13 PyObject *self, *args;
Guido van Rossume4c61311994-05-06 14:25:39 +000014{
15 char *word, *salt;
16 extern char * crypt();
17
Roger E. Masse56c345b1996-12-09 23:14:26 +000018 if (!PyArg_Parse(args, "(ss)", &word, &salt)) {
Guido van Rossume4c61311994-05-06 14:25:39 +000019 return NULL;
20 }
Roger E. Masse56c345b1996-12-09 23:14:26 +000021 return PyString_FromString( crypt( word, salt ) );
Guido van Rossume4c61311994-05-06 14:25:39 +000022
23}
24
Roger E. Masse56c345b1996-12-09 23:14:26 +000025static PyMethodDef crypt_methods[] = {
Guido van Rossume4c61311994-05-06 14:25:39 +000026 {"crypt", crypt_crypt},
27 {NULL, NULL} /* sentinel */
28};
29
Guido van Rossum3886bb61998-12-04 18:50:17 +000030DL_EXPORT(void)
Guido van Rossume4c61311994-05-06 14:25:39 +000031initcrypt()
32{
Roger E. Masse56c345b1996-12-09 23:14:26 +000033 Py_InitModule("crypt", crypt_methods);
Guido van Rossume4c61311994-05-06 14:25:39 +000034}