1/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(py_blake2b_new__doc__,
6"blake2b(string=None, *, digest_size=_blake2b.blake2b.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 BLAKE2b hash object.");
13
14static PyObject *
15py_blake2b_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
21static PyObject *
22py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23{
24    PyObject *return_value = NULL;
25    static const char * const _keywords[] = {"string", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL};
26    static _PyArg_Parser _parser = {"|O$iy*y*y*iiOOiip:blake2b", _keywords, 0};
27    PyObject *data = NULL;
28    int digest_size = BLAKE2B_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_obj, &node_offset_obj, &node_depth, &inner_size, &last_node)) {
42        goto exit;
43    }
44    return_value = py_blake2b_new_impl(type, data, digest_size, &key, &salt, &person, fanout, depth, leaf_size_obj, node_offset_obj, node_depth, inner_size, last_node);
45
46exit:
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
63PyDoc_STRVAR(_blake2b_blake2b_copy__doc__,
64"copy($self, /)\n"
65"--\n"
66"\n"
67"Return a copy of the hash object.");
68
69#define _BLAKE2B_BLAKE2B_COPY_METHODDEF    \
70    {"copy", (PyCFunction)_blake2b_blake2b_copy, METH_NOARGS, _blake2b_blake2b_copy__doc__},
71
72static PyObject *
73_blake2b_blake2b_copy_impl(BLAKE2bObject *self);
74
75static PyObject *
76_blake2b_blake2b_copy(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
77{
78    return _blake2b_blake2b_copy_impl(self);
79}
80
81PyDoc_STRVAR(_blake2b_blake2b_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 _BLAKE2B_BLAKE2B_UPDATE_METHODDEF    \
88    {"update", (PyCFunction)_blake2b_blake2b_update, METH_O, _blake2b_blake2b_update__doc__},
89
90PyDoc_STRVAR(_blake2b_blake2b_digest__doc__,
91"digest($self, /)\n"
92"--\n"
93"\n"
94"Return the digest value as a string of binary data.");
95
96#define _BLAKE2B_BLAKE2B_DIGEST_METHODDEF    \
97    {"digest", (PyCFunction)_blake2b_blake2b_digest, METH_NOARGS, _blake2b_blake2b_digest__doc__},
98
99static PyObject *
100_blake2b_blake2b_digest_impl(BLAKE2bObject *self);
101
102static PyObject *
103_blake2b_blake2b_digest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
104{
105    return _blake2b_blake2b_digest_impl(self);
106}
107
108PyDoc_STRVAR(_blake2b_blake2b_hexdigest__doc__,
109"hexdigest($self, /)\n"
110"--\n"
111"\n"
112"Return the digest value as a string of hexadecimal digits.");
113
114#define _BLAKE2B_BLAKE2B_HEXDIGEST_METHODDEF    \
115    {"hexdigest", (PyCFunction)_blake2b_blake2b_hexdigest, METH_NOARGS, _blake2b_blake2b_hexdigest__doc__},
116
117static PyObject *
118_blake2b_blake2b_hexdigest_impl(BLAKE2bObject *self);
119
120static PyObject *
121_blake2b_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
122{
123    return _blake2b_blake2b_hexdigest_impl(self);
124}
125/*[clinic end generated code: output=535a54852c98e51c input=a9049054013a1b77]*/
126