blob: 115db500f4d3d59680f97ce93f3b570ebccbb95d [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(SHA256Type_copy__doc__,
6"copy($self, /)\n"
7"--\n"
8"\n"
9"Return a copy of the hash object.");
10
11#define SHA256TYPE_COPY_METHODDEF \
12 {"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
13
14static PyObject *
15SHA256Type_copy_impl(SHAobject *self);
16
17static PyObject *
18SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
19{
20 return SHA256Type_copy_impl(self);
21}
22
23PyDoc_STRVAR(SHA256Type_digest__doc__,
24"digest($self, /)\n"
25"--\n"
26"\n"
27"Return the digest value as a string of binary data.");
28
29#define SHA256TYPE_DIGEST_METHODDEF \
30 {"digest", (PyCFunction)SHA256Type_digest, METH_NOARGS, SHA256Type_digest__doc__},
31
32static PyObject *
33SHA256Type_digest_impl(SHAobject *self);
34
35static PyObject *
36SHA256Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
37{
38 return SHA256Type_digest_impl(self);
39}
40
41PyDoc_STRVAR(SHA256Type_hexdigest__doc__,
42"hexdigest($self, /)\n"
43"--\n"
44"\n"
45"Return the digest value as a string of hexadecimal digits.");
46
47#define SHA256TYPE_HEXDIGEST_METHODDEF \
48 {"hexdigest", (PyCFunction)SHA256Type_hexdigest, METH_NOARGS, SHA256Type_hexdigest__doc__},
49
50static PyObject *
51SHA256Type_hexdigest_impl(SHAobject *self);
52
53static PyObject *
54SHA256Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
55{
56 return SHA256Type_hexdigest_impl(self);
57}
58
59PyDoc_STRVAR(SHA256Type_update__doc__,
60"update($self, obj, /)\n"
61"--\n"
62"\n"
63"Update this hash object\'s state with the provided string.");
64
65#define SHA256TYPE_UPDATE_METHODDEF \
66 {"update", (PyCFunction)SHA256Type_update, METH_O, SHA256Type_update__doc__},
67
68PyDoc_STRVAR(_sha256_sha256__doc__,
69"sha256($module, /, string=b\'\')\n"
70"--\n"
71"\n"
72"Return a new SHA-256 hash object; optionally initialized with a string.");
73
74#define _SHA256_SHA256_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -070075 {"sha256", (PyCFunction)_sha256_sha256, METH_FASTCALL, _sha256_sha256__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030076
77static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030078_sha256_sha256_impl(PyObject *module, PyObject *string);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030079
80static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -070081_sha256_sha256(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030082{
83 PyObject *return_value = NULL;
Serhiy Storchaka9171a8b2016-08-14 10:52:18 +030084 static const char * const _keywords[] = {"string", NULL};
85 static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0};
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030086 PyObject *string = NULL;
87
Victor Stinner37e4ef72016-09-09 20:00:13 -070088 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030089 &string)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030090 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030091 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030092 return_value = _sha256_sha256_impl(module, string);
93
94exit:
95 return return_value;
96}
97
98PyDoc_STRVAR(_sha256_sha224__doc__,
99"sha224($module, /, string=b\'\')\n"
100"--\n"
101"\n"
102"Return a new SHA-224 hash object; optionally initialized with a string.");
103
104#define _SHA256_SHA224_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -0700105 {"sha224", (PyCFunction)_sha256_sha224, METH_FASTCALL, _sha256_sha224__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300106
107static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300108_sha256_sha224_impl(PyObject *module, PyObject *string);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300109
110static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -0700111_sha256_sha224(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300112{
113 PyObject *return_value = NULL;
Serhiy Storchaka9171a8b2016-08-14 10:52:18 +0300114 static const char * const _keywords[] = {"string", NULL};
115 static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0};
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300116 PyObject *string = NULL;
117
Victor Stinner37e4ef72016-09-09 20:00:13 -0700118 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300119 &string)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300120 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300121 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300122 return_value = _sha256_sha224_impl(module, string);
123
124exit:
125 return return_value;
126}
Victor Stinner37e4ef72016-09-09 20:00:13 -0700127/*[clinic end generated code: output=19439d70db7ead5c input=a9049054013a1b77]*/