Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 1 | /* cryptmodule.c - by Steve Majewski |
| 2 | */ |
| 3 | |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 4 | #include "Python.h" |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 5 | |
| 6 | #include <sys/types.h> |
| 7 | |
| 8 | |
| 9 | /* Module crypt */ |
| 10 | |
| 11 | |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 12 | static PyObject *crypt_crypt(self, args) |
| 13 | PyObject *self, *args; |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 14 | { |
| 15 | char *word, *salt; |
| 16 | extern char * crypt(); |
| 17 | |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 18 | if (!PyArg_Parse(args, "(ss)", &word, &salt)) { |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 19 | return NULL; |
| 20 | } |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 21 | return PyString_FromString( crypt( word, salt ) ); |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 22 | |
| 23 | } |
| 24 | |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 25 | static PyMethodDef crypt_methods[] = { |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 26 | {"crypt", crypt_crypt}, |
| 27 | {NULL, NULL} /* sentinel */ |
| 28 | }; |
| 29 | |
Guido van Rossum | 3886bb6 | 1998-12-04 18:50:17 +0000 | [diff] [blame] | 30 | DL_EXPORT(void) |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 31 | initcrypt() |
| 32 | { |
Roger E. Masse | 56c345b | 1996-12-09 23:14:26 +0000 | [diff] [blame] | 33 | Py_InitModule("crypt", crypt_methods); |
Guido van Rossum | e4c6131 | 1994-05-06 14:25:39 +0000 | [diff] [blame] | 34 | } |