1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(MD5Type_copy__doc__,
6 "copy($self, /)\n"
7 "--\n"
8 "\n"
9 "Return a copy of the hash object.");
10
11 #define MD5TYPE_COPY_METHODDEF \
12 {"copy", (PyCFunction)(void(*)(void))MD5Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, MD5Type_copy__doc__},
13
14 static PyObject *
15 MD5Type_copy_impl(MD5object *self, PyTypeObject *cls);
16
17 static PyObject *
MD5Type_copy(MD5object * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)18 MD5Type_copy(MD5object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
19 {
20 PyObject *return_value = NULL;
21 static const char * const _keywords[] = { NULL};
22 static _PyArg_Parser _parser = {":copy", _keywords, 0};
23
24 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
25 )) {
26 goto exit;
27 }
28 return_value = MD5Type_copy_impl(self, cls);
29
30 exit:
31 return return_value;
32 }
33
34 PyDoc_STRVAR(MD5Type_digest__doc__,
35 "digest($self, /)\n"
36 "--\n"
37 "\n"
38 "Return the digest value as a bytes object.");
39
40 #define MD5TYPE_DIGEST_METHODDEF \
41 {"digest", (PyCFunction)MD5Type_digest, METH_NOARGS, MD5Type_digest__doc__},
42
43 static PyObject *
44 MD5Type_digest_impl(MD5object *self);
45
46 static PyObject *
MD5Type_digest(MD5object * self,PyObject * Py_UNUSED (ignored))47 MD5Type_digest(MD5object *self, PyObject *Py_UNUSED(ignored))
48 {
49 return MD5Type_digest_impl(self);
50 }
51
52 PyDoc_STRVAR(MD5Type_hexdigest__doc__,
53 "hexdigest($self, /)\n"
54 "--\n"
55 "\n"
56 "Return the digest value as a string of hexadecimal digits.");
57
58 #define MD5TYPE_HEXDIGEST_METHODDEF \
59 {"hexdigest", (PyCFunction)MD5Type_hexdigest, METH_NOARGS, MD5Type_hexdigest__doc__},
60
61 static PyObject *
62 MD5Type_hexdigest_impl(MD5object *self);
63
64 static PyObject *
MD5Type_hexdigest(MD5object * self,PyObject * Py_UNUSED (ignored))65 MD5Type_hexdigest(MD5object *self, PyObject *Py_UNUSED(ignored))
66 {
67 return MD5Type_hexdigest_impl(self);
68 }
69
70 PyDoc_STRVAR(MD5Type_update__doc__,
71 "update($self, obj, /)\n"
72 "--\n"
73 "\n"
74 "Update this hash object\'s state with the provided string.");
75
76 #define MD5TYPE_UPDATE_METHODDEF \
77 {"update", (PyCFunction)MD5Type_update, METH_O, MD5Type_update__doc__},
78
79 PyDoc_STRVAR(_md5_md5__doc__,
80 "md5($module, /, string=b\'\', *, usedforsecurity=True)\n"
81 "--\n"
82 "\n"
83 "Return a new MD5 hash object; optionally initialized with a string.");
84
85 #define _MD5_MD5_METHODDEF \
86 {"md5", (PyCFunction)(void(*)(void))_md5_md5, METH_FASTCALL|METH_KEYWORDS, _md5_md5__doc__},
87
88 static PyObject *
89 _md5_md5_impl(PyObject *module, PyObject *string, int usedforsecurity);
90
91 static PyObject *
_md5_md5(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)92 _md5_md5(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
93 {
94 PyObject *return_value = NULL;
95 static const char * const _keywords[] = {"string", "usedforsecurity", NULL};
96 static _PyArg_Parser _parser = {NULL, _keywords, "md5", 0};
97 PyObject *argsbuf[2];
98 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
99 PyObject *string = NULL;
100 int usedforsecurity = 1;
101
102 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
103 if (!args) {
104 goto exit;
105 }
106 if (!noptargs) {
107 goto skip_optional_pos;
108 }
109 if (args[0]) {
110 string = args[0];
111 if (!--noptargs) {
112 goto skip_optional_pos;
113 }
114 }
115 skip_optional_pos:
116 if (!noptargs) {
117 goto skip_optional_kwonly;
118 }
119 usedforsecurity = PyObject_IsTrue(args[1]);
120 if (usedforsecurity < 0) {
121 goto exit;
122 }
123 skip_optional_kwonly:
124 return_value = _md5_md5_impl(module, string, usedforsecurity);
125
126 exit:
127 return return_value;
128 }
129 /*[clinic end generated code: output=53ff7f22dbaaea36 input=a9049054013a1b77]*/
130