Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(38307)

Delta Between Two Patch Sets: Modules/_sha3/clinic/sha3module.c.h

Issue 16113: Add SHA-3 (Keccak) support
Left Patch Set: Created 6 years, 11 months ago
Right Patch Set: Created 3 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Modules/_sha3/cleanup.py ('k') | Modules/_sha3/kcp/align.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(py_sha3_new__doc__,
6 "sha3_224(string=None)\n"
7 "--\n"
8 "\n"
9 "Return a new SHA3 hash object with a hashbit length of 28 bytes.");
10
11 static PyObject *
12 py_sha3_new_impl(PyTypeObject *type, PyObject *data);
13
14 static PyObject *
15 py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16 {
17 PyObject *return_value = NULL;
18 static char *_keywords[] = {"string", NULL};
19 PyObject *data = NULL;
20
21 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha3_224", _keywords,
22 &data))
23 goto exit;
24 return_value = py_sha3_new_impl(type, data);
25
26 exit:
27 return return_value;
28 }
29
30 PyDoc_STRVAR(_sha3_sha3_224_copy__doc__,
31 "copy($self, /)\n"
32 "--\n"
33 "\n"
34 "Return a copy of the hash object.");
35
36 #define _SHA3_SHA3_224_COPY_METHODDEF \
37 {"copy", (PyCFunction)_sha3_sha3_224_copy, METH_NOARGS, _sha3_sha3_224_copy_ _doc__},
38
39 static PyObject *
40 _sha3_sha3_224_copy_impl(SHA3object *self);
41
42 static PyObject *
43 _sha3_sha3_224_copy(SHA3object *self, PyObject *Py_UNUSED(ignored))
44 {
45 return _sha3_sha3_224_copy_impl(self);
46 }
47
48 PyDoc_STRVAR(_sha3_sha3_224_digest__doc__,
49 "digest($self, /)\n"
50 "--\n"
51 "\n"
52 "Return the digest value as a string of binary data.");
53
54 #define _SHA3_SHA3_224_DIGEST_METHODDEF \
55 {"digest", (PyCFunction)_sha3_sha3_224_digest, METH_NOARGS, _sha3_sha3_224_d igest__doc__},
56
57 static PyObject *
58 _sha3_sha3_224_digest_impl(SHA3object *self);
59
60 static PyObject *
61 _sha3_sha3_224_digest(SHA3object *self, PyObject *Py_UNUSED(ignored))
62 {
63 return _sha3_sha3_224_digest_impl(self);
64 }
65
66 PyDoc_STRVAR(_sha3_sha3_224_hexdigest__doc__,
67 "hexdigest($self, /)\n"
68 "--\n"
69 "\n"
70 "Return the digest value as a string of hexadecimal digits.");
71
72 #define _SHA3_SHA3_224_HEXDIGEST_METHODDEF \
73 {"hexdigest", (PyCFunction)_sha3_sha3_224_hexdigest, METH_NOARGS, _sha3_sha3 _224_hexdigest__doc__},
74
75 static PyObject *
76 _sha3_sha3_224_hexdigest_impl(SHA3object *self);
77
78 static PyObject *
79 _sha3_sha3_224_hexdigest(SHA3object *self, PyObject *Py_UNUSED(ignored))
80 {
81 return _sha3_sha3_224_hexdigest_impl(self);
82 }
83
84 PyDoc_STRVAR(_sha3_sha3_224_update__doc__,
85 "update($self, obj, /)\n"
86 "--\n"
87 "\n"
88 "Update this hash object\'s state with the provided string.");
89
90 #define _SHA3_SHA3_224_UPDATE_METHODDEF \
91 {"update", (PyCFunction)_sha3_sha3_224_update, METH_O, _sha3_sha3_224_update __doc__},
92
93 PyDoc_STRVAR(_sha3_shake_128_digest__doc__,
94 "digest($self, /, length)\n"
95 "--\n"
96 "\n"
97 "Return the digest value as a string of binary data.");
98
99 #define _SHA3_SHAKE_128_DIGEST_METHODDEF \
100 {"digest", (PyCFunction)_sha3_shake_128_digest, METH_VARARGS|METH_KEYWORDS, _sha3_shake_128_digest__doc__},
101
102 static PyObject *
103 _sha3_shake_128_digest_impl(SHA3object *self, unsigned long length);
104
105 static PyObject *
106 _sha3_shake_128_digest(SHA3object *self, PyObject *args, PyObject *kwargs)
107 {
108 PyObject *return_value = NULL;
109 static char *_keywords[] = {"length", NULL};
110 unsigned long length;
111
112 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:digest", _keywords,
113 &length))
114 goto exit;
115 return_value = _sha3_shake_128_digest_impl(self, length);
116
117 exit:
118 return return_value;
119 }
120
121 PyDoc_STRVAR(_sha3_shake_128_hexdigest__doc__,
122 "hexdigest($self, /, length)\n"
123 "--\n"
124 "\n"
125 "Return the digest value as a string of hexadecimal digits.");
126
127 #define _SHA3_SHAKE_128_HEXDIGEST_METHODDEF \
128 {"hexdigest", (PyCFunction)_sha3_shake_128_hexdigest, METH_VARARGS|METH_KEYW ORDS, _sha3_shake_128_hexdigest__doc__},
129
130 static PyObject *
131 _sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length);
132
133 static PyObject *
134 _sha3_shake_128_hexdigest(SHA3object *self, PyObject *args, PyObject *kwargs)
135 {
136 PyObject *return_value = NULL;
137 static char *_keywords[] = {"length", NULL};
138 unsigned long length;
139
140 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:hexdigest", _keywords,
141 &length))
142 goto exit;
143 return_value = _sha3_shake_128_hexdigest_impl(self, length);
144
145 exit:
146 return return_value;
147 }
148 /*[clinic end generated code: output=2eb6db41778eeb50 input=a9049054013a1b77]*/
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+