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

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

Issue 26798: add BLAKE2 to hashlib
Patch Set: Created 3 years, 6 months 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 char *_keywords[] = {"string", "digest_size", "key", "salt", "person" , "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "la st_node", NULL};
26 PyObject *data = NULL;
27 int digest_size = BLAKE2S_OUTBYTES;
28 Py_buffer key = {NULL, NULL};
29 Py_buffer salt = {NULL, NULL};
30 Py_buffer person = {NULL, NULL};
31 int fanout = 1;
32 int depth = 1;
33 PyObject *leaf_size_obj = NULL;
34 PyObject *node_offset_obj = NULL;
35 int node_depth = 0;
36 int inner_size = 0;
37 int last_node = 0;
38
39 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O$iy*y*y*iiOOiip:blake2s", _keywords,
40 &data, &digest_size, &key, &salt, &person, &fanout, &depth, &leaf_size_o bj, &node_offset_obj, &node_depth, &inner_size, &last_node))
41 goto exit;
42 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);
43
44 exit:
45 /* Cleanup for key */
46 if (key.obj)
47 PyBuffer_Release(&key);
48 /* Cleanup for salt */
49 if (salt.obj)
50 PyBuffer_Release(&salt);
51 /* Cleanup for person */
52 if (person.obj)
53 PyBuffer_Release(&person);
54
55 return return_value;
56 }
57
58 PyDoc_STRVAR(_blake2s_blake2s_copy__doc__,
59 "copy($self, /)\n"
60 "--\n"
61 "\n"
62 "Return a copy of the hash object.");
63
64 #define _BLAKE2S_BLAKE2S_COPY_METHODDEF \
65 {"copy", (PyCFunction)_blake2s_blake2s_copy, METH_NOARGS, _blake2s_blake2s_c opy__doc__},
66
67 static PyObject *
68 _blake2s_blake2s_copy_impl(BLAKE2sObject *self);
69
70 static PyObject *
71 _blake2s_blake2s_copy(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
72 {
73 return _blake2s_blake2s_copy_impl(self);
74 }
75
76 PyDoc_STRVAR(_blake2s_blake2s_update__doc__,
77 "update($self, obj, /)\n"
78 "--\n"
79 "\n"
80 "Update this hash object\'s state with the provided string.");
81
82 #define _BLAKE2S_BLAKE2S_UPDATE_METHODDEF \
83 {"update", (PyCFunction)_blake2s_blake2s_update, METH_O, _blake2s_blake2s_up date__doc__},
84
85 PyDoc_STRVAR(_blake2s_blake2s_digest__doc__,
86 "digest($self, /)\n"
87 "--\n"
88 "\n"
89 "Return the digest value as a string of binary data.");
90
91 #define _BLAKE2S_BLAKE2S_DIGEST_METHODDEF \
92 {"digest", (PyCFunction)_blake2s_blake2s_digest, METH_NOARGS, _blake2s_blake 2s_digest__doc__},
93
94 static PyObject *
95 _blake2s_blake2s_digest_impl(BLAKE2sObject *self);
96
97 static PyObject *
98 _blake2s_blake2s_digest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
99 {
100 return _blake2s_blake2s_digest_impl(self);
101 }
102
103 PyDoc_STRVAR(_blake2s_blake2s_hexdigest__doc__,
104 "hexdigest($self, /)\n"
105 "--\n"
106 "\n"
107 "Return the digest value as a string of hexadecimal digits.");
108
109 #define _BLAKE2S_BLAKE2S_HEXDIGEST_METHODDEF \
110 {"hexdigest", (PyCFunction)_blake2s_blake2s_hexdigest, METH_NOARGS, _blake2s _blake2s_hexdigest__doc__},
111
112 static PyObject *
113 _blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self);
114
115 static PyObject *
116 _blake2s_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
117 {
118 return _blake2s_blake2s_hexdigest_impl(self);
119 }
120 /*[clinic end generated code: output=b803ac798d95db7c 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+