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

Side by Side Diff: Modules/_blake2/clinic/blake2s_impl.c.h

Issue 26798: add BLAKE2 to hashlib
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:
View unified diff | Download patch
« no previous file with comments | « Modules/_blake2/clinic/blake2b_impl.c.h ('k') | Modules/_blake2/impl/blake2b.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(py_blake2s_new__doc__,
6 "blake2s(string=None, *, digest_size=_blake2s.blake2s.MAX_DIGEST_SIZE,\n"
7 " key=None, salt=None, person=None, fanout=1, depth=1,\n"
8 " leaf_size=None, node_offset=None, node_depth=0, inner_size=0,\n"
9 " last_node=False)\n"
10 "--\n"
11 "\n"
12 "Return a new BLAKE2s hash object.");
13
14 static PyObject *
15 py_blake2s_new_impl(PyTypeObject *type, PyObject *data, int digest_size,
16 Py_buffer *key, Py_buffer *salt, Py_buffer *person,
17 int fanout, int depth, PyObject *leaf_size_obj,
18 PyObject *node_offset_obj, int node_depth,
19 int inner_size, int last_node);
20
21 static PyObject *
22 py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23 {
24 PyObject *return_value = NULL;
25 static const char * const _keywords[] = {"string", "digest_size", "key", "sa lt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inn er_size", "last_node", NULL};
26 static _PyArg_Parser _parser = {"|O$iy*y*y*iiOOiip:blake2s", _keywords, 0};
27 PyObject *data = NULL;
28 int digest_size = BLAKE2S_OUTBYTES;
29 Py_buffer key = {NULL, NULL};
30 Py_buffer salt = {NULL, NULL};
31 Py_buffer person = {NULL, NULL};
32 int fanout = 1;
33 int depth = 1;
34 PyObject *leaf_size_obj = NULL;
35 PyObject *node_offset_obj = NULL;
36 int node_depth = 0;
37 int inner_size = 0;
38 int last_node = 0;
39
40 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
41 &data, &digest_size, &key, &salt, &person, &fanout, &depth, &leaf_size_o bj, &node_offset_obj, &node_depth, &inner_size, &last_node)) {
42 goto exit;
43 }
44 return_value = py_blake2s_new_impl(type, data, digest_size, &key, &salt, &pe rson, fanout, depth, leaf_size_obj, node_offset_obj, node_depth, inner_size, las t_node);
45
46 exit:
47 /* Cleanup for key */
48 if (key.obj) {
49 PyBuffer_Release(&key);
50 }
51 /* Cleanup for salt */
52 if (salt.obj) {
53 PyBuffer_Release(&salt);
54 }
55 /* Cleanup for person */
56 if (person.obj) {
57 PyBuffer_Release(&person);
58 }
59
60 return return_value;
61 }
62
63 PyDoc_STRVAR(_blake2s_blake2s_copy__doc__,
64 "copy($self, /)\n"
65 "--\n"
66 "\n"
67 "Return a copy of the hash object.");
68
69 #define _BLAKE2S_BLAKE2S_COPY_METHODDEF \
70 {"copy", (PyCFunction)_blake2s_blake2s_copy, METH_NOARGS, _blake2s_blake2s_c opy__doc__},
71
72 static PyObject *
73 _blake2s_blake2s_copy_impl(BLAKE2sObject *self);
74
75 static PyObject *
76 _blake2s_blake2s_copy(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
77 {
78 return _blake2s_blake2s_copy_impl(self);
79 }
80
81 PyDoc_STRVAR(_blake2s_blake2s_update__doc__,
82 "update($self, obj, /)\n"
83 "--\n"
84 "\n"
85 "Update this hash object\'s state with the provided string.");
86
87 #define _BLAKE2S_BLAKE2S_UPDATE_METHODDEF \
88 {"update", (PyCFunction)_blake2s_blake2s_update, METH_O, _blake2s_blake2s_up date__doc__},
89
90 PyDoc_STRVAR(_blake2s_blake2s_digest__doc__,
91 "digest($self, /)\n"
92 "--\n"
93 "\n"
94 "Return the digest value as a string of binary data.");
95
96 #define _BLAKE2S_BLAKE2S_DIGEST_METHODDEF \
97 {"digest", (PyCFunction)_blake2s_blake2s_digest, METH_NOARGS, _blake2s_blake 2s_digest__doc__},
98
99 static PyObject *
100 _blake2s_blake2s_digest_impl(BLAKE2sObject *self);
101
102 static PyObject *
103 _blake2s_blake2s_digest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
104 {
105 return _blake2s_blake2s_digest_impl(self);
106 }
107
108 PyDoc_STRVAR(_blake2s_blake2s_hexdigest__doc__,
109 "hexdigest($self, /)\n"
110 "--\n"
111 "\n"
112 "Return the digest value as a string of hexadecimal digits.");
113
114 #define _BLAKE2S_BLAKE2S_HEXDIGEST_METHODDEF \
115 {"hexdigest", (PyCFunction)_blake2s_blake2s_hexdigest, METH_NOARGS, _blake2s _blake2s_hexdigest__doc__},
116
117 static PyObject *
118 _blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self);
119
120 static PyObject *
121 _blake2s_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
122 {
123 return _blake2s_blake2s_hexdigest_impl(self);
124 }
125 /*[clinic end generated code: output=535ea7903f9ccf76 input=a9049054013a1b77]*/
OLDNEW
« no previous file with comments | « Modules/_blake2/clinic/blake2b_impl.c.h ('k') | Modules/_blake2/impl/blake2b.c » ('j') | no next file with comments »

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