Line data Source code
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_CAST(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 *
18 2 : SHA512Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
19 : {
20 2 : if (nargs) {
21 0 : PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
22 0 : return NULL;
23 : }
24 2 : return SHA512Type_copy_impl(self, cls);
25 : }
26 :
27 : PyDoc_STRVAR(SHA512Type_digest__doc__,
28 : "digest($self, /)\n"
29 : "--\n"
30 : "\n"
31 : "Return the digest value as a bytes object.");
32 :
33 : #define SHA512TYPE_DIGEST_METHODDEF \
34 : {"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
35 :
36 : static PyObject *
37 : SHA512Type_digest_impl(SHAobject *self);
38 :
39 : static PyObject *
40 42 : SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
41 : {
42 42 : return SHA512Type_digest_impl(self);
43 : }
44 :
45 : PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
46 : "hexdigest($self, /)\n"
47 : "--\n"
48 : "\n"
49 : "Return the digest value as a string of hexadecimal digits.");
50 :
51 : #define SHA512TYPE_HEXDIGEST_METHODDEF \
52 : {"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
53 :
54 : static PyObject *
55 : SHA512Type_hexdigest_impl(SHAobject *self);
56 :
57 : static PyObject *
58 30 : SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
59 : {
60 30 : return SHA512Type_hexdigest_impl(self);
61 : }
62 :
63 : PyDoc_STRVAR(SHA512Type_update__doc__,
64 : "update($self, obj, /)\n"
65 : "--\n"
66 : "\n"
67 : "Update this hash object\'s state with the provided string.");
68 :
69 : #define SHA512TYPE_UPDATE_METHODDEF \
70 : {"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
71 :
72 : PyDoc_STRVAR(_sha512_sha512__doc__,
73 : "sha512($module, /, string=b\'\', *, usedforsecurity=True)\n"
74 : "--\n"
75 : "\n"
76 : "Return a new SHA-512 hash object; optionally initialized with a string.");
77 :
78 : #define _SHA512_SHA512_METHODDEF \
79 : {"sha512", _PyCFunction_CAST(_sha512_sha512), METH_FASTCALL|METH_KEYWORDS, _sha512_sha512__doc__},
80 :
81 : static PyObject *
82 : _sha512_sha512_impl(PyObject *module, PyObject *string, int usedforsecurity);
83 :
84 : static PyObject *
85 42 : _sha512_sha512(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
86 : {
87 42 : PyObject *return_value = NULL;
88 : static const char * const _keywords[] = {"string", "usedforsecurity", NULL};
89 : static _PyArg_Parser _parser = {NULL, _keywords, "sha512", 0};
90 : PyObject *argsbuf[2];
91 42 : Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
92 42 : PyObject *string = NULL;
93 42 : int usedforsecurity = 1;
94 :
95 42 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
96 42 : if (!args) {
97 0 : goto exit;
98 : }
99 42 : if (!noptargs) {
100 10 : goto skip_optional_pos;
101 : }
102 32 : if (args[0]) {
103 23 : string = args[0];
104 23 : if (!--noptargs) {
105 17 : goto skip_optional_pos;
106 : }
107 : }
108 15 : skip_optional_pos:
109 42 : if (!noptargs) {
110 27 : goto skip_optional_kwonly;
111 : }
112 15 : usedforsecurity = PyObject_IsTrue(args[1]);
113 15 : if (usedforsecurity < 0) {
114 0 : goto exit;
115 : }
116 15 : skip_optional_kwonly:
117 42 : return_value = _sha512_sha512_impl(module, string, usedforsecurity);
118 :
119 42 : exit:
120 42 : return return_value;
121 : }
122 :
123 : PyDoc_STRVAR(_sha512_sha384__doc__,
124 : "sha384($module, /, string=b\'\', *, usedforsecurity=True)\n"
125 : "--\n"
126 : "\n"
127 : "Return a new SHA-384 hash object; optionally initialized with a string.");
128 :
129 : #define _SHA512_SHA384_METHODDEF \
130 : {"sha384", _PyCFunction_CAST(_sha512_sha384), METH_FASTCALL|METH_KEYWORDS, _sha512_sha384__doc__},
131 :
132 : static PyObject *
133 : _sha512_sha384_impl(PyObject *module, PyObject *string, int usedforsecurity);
134 :
135 : static PyObject *
136 30 : _sha512_sha384(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
137 : {
138 30 : PyObject *return_value = NULL;
139 : static const char * const _keywords[] = {"string", "usedforsecurity", NULL};
140 : static _PyArg_Parser _parser = {NULL, _keywords, "sha384", 0};
141 : PyObject *argsbuf[2];
142 30 : Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
143 30 : PyObject *string = NULL;
144 30 : int usedforsecurity = 1;
145 :
146 30 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
147 30 : if (!args) {
148 0 : goto exit;
149 : }
150 30 : if (!noptargs) {
151 10 : goto skip_optional_pos;
152 : }
153 20 : if (args[0]) {
154 11 : string = args[0];
155 11 : if (!--noptargs) {
156 5 : goto skip_optional_pos;
157 : }
158 : }
159 15 : skip_optional_pos:
160 30 : if (!noptargs) {
161 15 : goto skip_optional_kwonly;
162 : }
163 15 : usedforsecurity = PyObject_IsTrue(args[1]);
164 15 : if (usedforsecurity < 0) {
165 0 : goto exit;
166 : }
167 15 : skip_optional_kwonly:
168 30 : return_value = _sha512_sha384_impl(module, string, usedforsecurity);
169 :
170 30 : exit:
171 30 : return return_value;
172 : }
173 : /*[clinic end generated code: output=60a0a1a28c07f391 input=a9049054013a1b77]*/
|