1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(SHA512Type_copy__doc__,
6 "copy($self, /)\n"
7 "--\n"
8 "\n"
9 "Return a copy of the hash object.");
10
11 #define SHA512TYPE_COPY_METHODDEF \
12 {"copy", (PyCFunction)(void(*)(void))SHA512Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA512Type_copy__doc__},
13
14 static PyObject *
15 SHA512Type_copy_impl(SHAobject *self, PyTypeObject *cls);
16
17 static PyObject *
SHA512Type_copy(SHAobject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)18 SHA512Type_copy(SHAobject *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 = SHA512Type_copy_impl(self, cls);
29
30 exit:
31 return return_value;
32 }
33
34 PyDoc_STRVAR(SHA512Type_digest__doc__,
35 "digest($self, /)\n"
36 "--\n"
37 "\n"
38 "Return the digest value as a bytes object.");
39
40 #define SHA512TYPE_DIGEST_METHODDEF \
41 {"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
42
43 static PyObject *
44 SHA512Type_digest_impl(SHAobject *self);
45
46 static PyObject *
SHA512Type_digest(SHAobject * self,PyObject * Py_UNUSED (ignored))47 SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
48 {
49 return SHA512Type_digest_impl(self);
50 }
51
52 PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
53 "hexdigest($self, /)\n"
54 "--\n"
55 "\n"
56 "Return the digest value as a string of hexadecimal digits.");
57
58 #define SHA512TYPE_HEXDIGEST_METHODDEF \
59 {"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
60
61 static PyObject *
62 SHA512Type_hexdigest_impl(SHAobject *self);
63
64 static PyObject *
SHA512Type_hexdigest(SHAobject * self,PyObject * Py_UNUSED (ignored))65 SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
66 {
67 return SHA512Type_hexdigest_impl(self);
68 }
69
70 PyDoc_STRVAR(SHA512Type_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 SHA512TYPE_UPDATE_METHODDEF \
77 {"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
78
79 PyDoc_STRVAR(_sha512_sha512__doc__,
80 "sha512($module, /, string=b\'\', *, usedforsecurity=True)\n"
81 "--\n"
82 "\n"
83 "Return a new SHA-512 hash object; optionally initialized with a string.");
84
85 #define _SHA512_SHA512_METHODDEF \
86 {"sha512", (PyCFunction)(void(*)(void))_sha512_sha512, METH_FASTCALL|METH_KEYWORDS, _sha512_sha512__doc__},
87
88 static PyObject *
89 _sha512_sha512_impl(PyObject *module, PyObject *string, int usedforsecurity);
90
91 static PyObject *
_sha512_sha512(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)92 _sha512_sha512(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, "sha512", 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 = _sha512_sha512_impl(module, string, usedforsecurity);
125
126 exit:
127 return return_value;
128 }
129
130 PyDoc_STRVAR(_sha512_sha384__doc__,
131 "sha384($module, /, string=b\'\', *, usedforsecurity=True)\n"
132 "--\n"
133 "\n"
134 "Return a new SHA-384 hash object; optionally initialized with a string.");
135
136 #define _SHA512_SHA384_METHODDEF \
137 {"sha384", (PyCFunction)(void(*)(void))_sha512_sha384, METH_FASTCALL|METH_KEYWORDS, _sha512_sha384__doc__},
138
139 static PyObject *
140 _sha512_sha384_impl(PyObject *module, PyObject *string, int usedforsecurity);
141
142 static PyObject *
_sha512_sha384(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)143 _sha512_sha384(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
144 {
145 PyObject *return_value = NULL;
146 static const char * const _keywords[] = {"string", "usedforsecurity", NULL};
147 static _PyArg_Parser _parser = {NULL, _keywords, "sha384", 0};
148 PyObject *argsbuf[2];
149 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
150 PyObject *string = NULL;
151 int usedforsecurity = 1;
152
153 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
154 if (!args) {
155 goto exit;
156 }
157 if (!noptargs) {
158 goto skip_optional_pos;
159 }
160 if (args[0]) {
161 string = args[0];
162 if (!--noptargs) {
163 goto skip_optional_pos;
164 }
165 }
166 skip_optional_pos:
167 if (!noptargs) {
168 goto skip_optional_kwonly;
169 }
170 usedforsecurity = PyObject_IsTrue(args[1]);
171 if (usedforsecurity < 0) {
172 goto exit;
173 }
174 skip_optional_kwonly:
175 return_value = _sha512_sha384_impl(module, string, usedforsecurity);
176
177 exit:
178 return return_value;
179 }
180 /*[clinic end generated code: output=9ff9f11937fabf35 input=a9049054013a1b77]*/
181