Mercurial > cpython-lru_cache-weakref
annotate Modules/cryptmodule.c @ 13163:a09e8635534d legacy-trunk
Don't try to guess the name of a .def file -- if one is supplied, use it,
otherwise just generate an '/export:' option.
| author | Greg Ward <gward@python.net> |
|---|---|
| date | Thu, 29 Jun 2000 23:09:20 +0000 |
| parents | 47d70f4f635f |
| children | 03bc51e43f7a |
| rev | line source |
|---|---|
| 1617 | 1 /* cryptmodule.c - by Steve Majewski |
| 2 */ | |
| 3 | |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
4 #include "Python.h" |
| 1617 | 5 |
| 6 #include <sys/types.h> | |
| 7 | |
| 8 | |
| 9 /* Module crypt */ | |
| 10 | |
| 11 | |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
12 static PyObject *crypt_crypt(self, args) |
|
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
13 PyObject *self, *args; |
| 1617 | 14 { |
| 15 char *word, *salt; | |
| 16 extern char * crypt(); | |
| 17 | |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
18 if (!PyArg_Parse(args, "(ss)", &word, &salt)) { |
| 1617 | 19 return NULL; |
| 20 } | |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
21 return PyString_FromString( crypt( word, salt ) ); |
| 1617 | 22 |
| 23 } | |
| 24 | |
|
11687
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
25 static char crypt_crypt__doc__[] = "\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
26 crypt(word, salt) -> string\n\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
27 word will usually be a user's password. salt is a 2-character string\n\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
28 which will be used to select one of 4096 variations of DES. The characters\n\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
29 in salt must be either \".\", \"/\", or an alphanumeric character. Returns\n\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
30 the hashed password as a string, which will be composed of characters from\n\ |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
31 the same alphabet as the salt."; |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
32 |
|
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
33 |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
34 static PyMethodDef crypt_methods[] = { |
|
11687
47d70f4f635f
Added docstring to crypt.crypt() based on the documentation.
Fred Drake <fdrake@acm.org>
parents:
9588
diff
changeset
|
35 {"crypt", crypt_crypt, 0, crypt_crypt__doc__}, |
| 1617 | 36 {NULL, NULL} /* sentinel */ |
| 37 }; | |
| 38 | |
|
9588
38023a425e48
Add DL_EXPORT() to all modules that could possibly be used
Guido van Rossum <guido@python.org>
parents:
4643
diff
changeset
|
39 DL_EXPORT(void) |
| 1617 | 40 initcrypt() |
| 41 { | |
|
4643
8d909ae1f099
renamed grandly.
Roger E. Masse <rmasse@newcnri.cnri.reston.va.us>
parents:
4600
diff
changeset
|
42 Py_InitModule("crypt", crypt_methods); |
| 1617 | 43 } |
