• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(SHA1Type_copy__doc__,
6 "copy($self, /)\n"
7 "--\n"
8 "\n"
9 "Return a copy of the hash object.");
10 
11 #define SHA1TYPE_COPY_METHODDEF    \
12     {"copy", (PyCFunction)(void(*)(void))SHA1Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA1Type_copy__doc__},
13 
14 static PyObject *
15 SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls);
16 
17 static PyObject *
SHA1Type_copy(SHA1object * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)18 SHA1Type_copy(SHA1object *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 = SHA1Type_copy_impl(self, cls);
29 
30 exit:
31     return return_value;
32 }
33 
34 PyDoc_STRVAR(SHA1Type_digest__doc__,
35 "digest($self, /)\n"
36 "--\n"
37 "\n"
38 "Return the digest value as a bytes object.");
39 
40 #define SHA1TYPE_DIGEST_METHODDEF    \
41     {"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
42 
43 static PyObject *
44 SHA1Type_digest_impl(SHA1object *self);
45 
46 static PyObject *
SHA1Type_digest(SHA1object * self,PyObject * Py_UNUSED (ignored))47 SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
48 {
49     return SHA1Type_digest_impl(self);
50 }
51 
52 PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
53 "hexdigest($self, /)\n"
54 "--\n"
55 "\n"
56 "Return the digest value as a string of hexadecimal digits.");
57 
58 #define SHA1TYPE_HEXDIGEST_METHODDEF    \
59     {"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
60 
61 static PyObject *
62 SHA1Type_hexdigest_impl(SHA1object *self);
63 
64 static PyObject *
SHA1Type_hexdigest(SHA1object * self,PyObject * Py_UNUSED (ignored))65 SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
66 {
67     return SHA1Type_hexdigest_impl(self);
68 }
69 
70 PyDoc_STRVAR(SHA1Type_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 SHA1TYPE_UPDATE_METHODDEF    \
77     {"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
78 
79 PyDoc_STRVAR(_sha1_sha1__doc__,
80 "sha1($module, /, string=b\'\', *, usedforsecurity=True)\n"
81 "--\n"
82 "\n"
83 "Return a new SHA1 hash object; optionally initialized with a string.");
84 
85 #define _SHA1_SHA1_METHODDEF    \
86     {"sha1", (PyCFunction)(void(*)(void))_sha1_sha1, METH_FASTCALL|METH_KEYWORDS, _sha1_sha1__doc__},
87 
88 static PyObject *
89 _sha1_sha1_impl(PyObject *module, PyObject *string, int usedforsecurity);
90 
91 static PyObject *
_sha1_sha1(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)92 _sha1_sha1(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, "sha1", 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 = _sha1_sha1_impl(module, string, usedforsecurity);
125 
126 exit:
127     return return_value;
128 }
129 /*[clinic end generated code: output=abf1ab2545cea5a2 input=a9049054013a1b77]*/
130