| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | /* cryptmodule.c - by Steve Majewski
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | #include "Python.h"
 | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <sys/types.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Module crypt */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | static PyObject *crypt_crypt(self, args) | 
					
						
							|  |  |  | 	PyObject *self, *args; | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	char *word, *salt;  | 
					
						
							|  |  |  | 	extern char * crypt(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "(ss)", &word, &salt)) { | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | 	return PyString_FromString( crypt( word, salt ) ); | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | static PyMethodDef crypt_methods[] = { | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | 	{"crypt",	crypt_crypt}, | 
					
						
							|  |  |  | 	{NULL,		NULL}		/* sentinel */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-04 18:50:17 +00:00
										 |  |  | DL_EXPORT(void) | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | initcrypt() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											1996-12-09 23:14:26 +00:00
										 |  |  | 	Py_InitModule("crypt", crypt_methods); | 
					
						
							| 
									
										
										
										
											1994-05-06 14:25:39 +00:00
										 |  |  | } |