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

Delta Between Two Patch Sets: Modules/_blake2/clinic/blake2s_impl.c.h

Issue 26798: add BLAKE2 to hashlib
Left Patch Set: Created 3 years, 2 months ago
Right Patch Set: Created 2 years, 11 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Modules/_blake2/clinic/blake2b_impl.c.h ('k') | Modules/_blake2/impl/blake2b.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*[clinic input] 1 /*[clinic input]
2 preserve 2 preserve
3 [clinic start generated code]*/ 3 [clinic start generated code]*/
4 4
5 PyDoc_STRVAR(py_blake2s_new__doc__, 5 PyDoc_STRVAR(py_blake2s_new__doc__,
6 "blake2s(string=None, *, digest_size=_blake2s.blake2s.MAX_DIGEST_SIZE,\n" 6 "blake2s(string=None, *, digest_size=_blake2s.blake2s.MAX_DIGEST_SIZE,\n"
7 " key=None, salt=None, person=None, fanout=1, depth=1,\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" 8 " leaf_size=None, node_offset=None, node_depth=0, inner_size=0,\n"
9 " last_node=False)\n" 9 " last_node=False)\n"
10 "--\n" 10 "--\n"
11 "\n" 11 "\n"
12 "Return a new BLAKE2s hash object."); 12 "Return a new BLAKE2s hash object.");
13 13
14 static PyObject * 14 static PyObject *
15 py_blake2s_new_impl(PyTypeObject *type, PyObject *data, int digest_size, 15 py_blake2s_new_impl(PyTypeObject *type, PyObject *data, int digest_size,
16 Py_buffer *key, Py_buffer *salt, Py_buffer *person, 16 Py_buffer *key, Py_buffer *salt, Py_buffer *person,
17 int fanout, int depth, PyObject *leaf_size_obj, 17 int fanout, int depth, PyObject *leaf_size_obj,
18 PyObject *node_offset_obj, int node_depth, 18 PyObject *node_offset_obj, int node_depth,
19 int inner_size, int last_node); 19 int inner_size, int last_node);
20 20
21 static PyObject * 21 static PyObject *
22 py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) 22 py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23 { 23 {
24 PyObject *return_value = NULL; 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}; 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};
26 PyObject *data = NULL; 27 PyObject *data = NULL;
27 int digest_size = BLAKE2S_OUTBYTES; 28 int digest_size = BLAKE2S_OUTBYTES;
28 Py_buffer key = {NULL, NULL}; 29 Py_buffer key = {NULL, NULL};
29 Py_buffer salt = {NULL, NULL}; 30 Py_buffer salt = {NULL, NULL};
30 Py_buffer person = {NULL, NULL}; 31 Py_buffer person = {NULL, NULL};
31 int fanout = 1; 32 int fanout = 1;
32 int depth = 1; 33 int depth = 1;
33 PyObject *leaf_size_obj = NULL; 34 PyObject *leaf_size_obj = NULL;
34 PyObject *node_offset_obj = NULL; 35 PyObject *node_offset_obj = NULL;
35 int node_depth = 0; 36 int node_depth = 0;
36 int inner_size = 0; 37 int inner_size = 0;
37 int last_node = 0; 38 int last_node = 0;
38 39
39 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O$iy*y*y*iiOOiip:blake2s", _keywords, 40 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
40 &data, &digest_size, &key, &salt, &person, &fanout, &depth, &leaf_size_o bj, &node_offset_obj, &node_depth, &inner_size, &last_node)) 41 &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 goto exit;
43 }
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); 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);
43 45
44 exit: 46 exit:
45 /* Cleanup for key */ 47 /* Cleanup for key */
46 if (key.obj) 48 if (key.obj) {
47 PyBuffer_Release(&key); 49 PyBuffer_Release(&key);
50 }
48 /* Cleanup for salt */ 51 /* Cleanup for salt */
49 if (salt.obj) 52 if (salt.obj) {
50 PyBuffer_Release(&salt); 53 PyBuffer_Release(&salt);
54 }
51 /* Cleanup for person */ 55 /* Cleanup for person */
52 if (person.obj) 56 if (person.obj) {
53 PyBuffer_Release(&person); 57 PyBuffer_Release(&person);
58 }
54 59
55 return return_value; 60 return return_value;
56 } 61 }
57 62
58 PyDoc_STRVAR(_blake2s_blake2s_copy__doc__, 63 PyDoc_STRVAR(_blake2s_blake2s_copy__doc__,
59 "copy($self, /)\n" 64 "copy($self, /)\n"
60 "--\n" 65 "--\n"
61 "\n" 66 "\n"
62 "Return a copy of the hash object."); 67 "Return a copy of the hash object.");
63 68
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 {"hexdigest", (PyCFunction)_blake2s_blake2s_hexdigest, METH_NOARGS, _blake2s _blake2s_hexdigest__doc__}, 115 {"hexdigest", (PyCFunction)_blake2s_blake2s_hexdigest, METH_NOARGS, _blake2s _blake2s_hexdigest__doc__},
111 116
112 static PyObject * 117 static PyObject *
113 _blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self); 118 _blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self);
114 119
115 static PyObject * 120 static PyObject *
116 _blake2s_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) 121 _blake2s_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
117 { 122 {
118 return _blake2s_blake2s_hexdigest_impl(self); 123 return _blake2s_blake2s_hexdigest_impl(self);
119 } 124 }
120 /*[clinic end generated code: output=b803ac798d95db7c input=a9049054013a1b77]*/ 125 /*[clinic end generated code: output=535ea7903f9ccf76 input=a9049054013a1b77]*/
LEFTRIGHT

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