cryptmodule.c 505 Bytes
Newer Older
1 2 3
/* cryptmodule.c - by Steve Majewski
 */

Roger E. Masse's avatar
Roger E. Masse committed
4
#include "Python.h"
5 6 7 8 9 10 11

#include <sys/types.h>


/* Module crypt */


Roger E. Masse's avatar
Roger E. Masse committed
12 13
static PyObject *crypt_crypt(self, args)
	PyObject *self, *args;
14 15 16 17
{
	char *word, *salt; 
	extern char * crypt();

Roger E. Masse's avatar
Roger E. Masse committed
18
	if (!PyArg_Parse(args, "(ss)", &word, &salt)) {
19 20
		return NULL;
	}
Roger E. Masse's avatar
Roger E. Masse committed
21
	return PyString_FromString( crypt( word, salt ) );
22 23 24

}

Roger E. Masse's avatar
Roger E. Masse committed
25
static PyMethodDef crypt_methods[] = {
26 27 28 29 30 31 32
	{"crypt",	crypt_crypt},
	{NULL,		NULL}		/* sentinel */
};

void
initcrypt()
{
Roger E. Masse's avatar
Roger E. Masse committed
33
	Py_InitModule("crypt", crypt_methods);
34
}