mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
crypt module (Steve M's)
This commit is contained in:
parent
7a325c385b
commit
e4c6131baa
4 changed files with 37 additions and 320 deletions
36
Modules/cryptmodule.c
Normal file
36
Modules/cryptmodule.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* cryptmodule.c - by Steve Majewski
|
||||
*/
|
||||
|
||||
#include "allobjects.h"
|
||||
#include "modsupport.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* Module crypt */
|
||||
|
||||
|
||||
static object *crypt_crypt(self, args)
|
||||
object *self, *args;
|
||||
{
|
||||
char *word, *salt;
|
||||
extern char * crypt();
|
||||
|
||||
struct passwd *p;
|
||||
if (!getargs(args, "(ss)", &word, &salt)) {
|
||||
return NULL;
|
||||
}
|
||||
return newstringobject( crypt( word, salt ) );
|
||||
|
||||
}
|
||||
|
||||
static struct methodlist crypt_methods[] = {
|
||||
{"crypt", crypt_crypt},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
void
|
||||
initcrypt()
|
||||
{
|
||||
initmodule("crypt", crypt_methods);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue