diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-07-31 06:50:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 06:50:16 (GMT) |
commit | f1d36d8efaecd5c84cb35e35119b283f37d83c40 (patch) | |
tree | 055434182e3f7859d01386eac0766fc7a1d69193 /Modules/_blake2 | |
parent | 4b8a7f51da224d1a0ad8159935f78ba4e6e16037 (diff) | |
download | cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.zip cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.tar.gz cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.tar.bz2 |
bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346)
* help(hashlib) didn't work because of incorrect module name in blake2b and
blake2s classes.
* Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly
accepted keyword argument "string" for binary data, but documented as
accepting the "data" keyword argument. Now this parameter is positional-only.
* Keyword-only parameters in blake2b() and blake2s() were not documented as
keyword-only.
* Default value for some parameters of blake2b() and blake2s() was None,
which is not acceptable value.
* The length argument for shake_*.digest() was wrapped out to 32 bits.
* The argument for shake_128.digest() and shake_128.hexdigest() was not
positional-only as intended.
* TypeError messages for incorrect arguments in all constructors sha3_*(),
shake_*() and keccak_*() incorrectly referred to sha3_224.
Also made the following enhancements:
* More accurately specified input and result types for strings, bytes and
bytes-like objects.
* Unified positional parameter names for update() and constructors.
* Improved formatting.
Diffstat (limited to 'Modules/_blake2')
-rw-r--r-- | Modules/_blake2/blake2b_impl.c | 61 | ||||
-rw-r--r-- | Modules/_blake2/blake2s_impl.c | 61 | ||||
-rw-r--r-- | Modules/_blake2/clinic/blake2b_impl.c.h | 59 | ||||
-rw-r--r-- | Modules/_blake2/clinic/blake2s_impl.c.h | 59 |
4 files changed, 120 insertions, 120 deletions
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c index 92d7c5c..7ad4b65 100644 --- a/Modules/_blake2/blake2b_impl.c +++ b/Modules/_blake2/blake2b_impl.c @@ -47,10 +47,10 @@ typedef struct { #include "clinic/blake2b_impl.c.h" /*[clinic input] -module _blake2b -class _blake2b.blake2b "BLAKE2bObject *" "&PyBlake2_BLAKE2bType" +module _blake2 +class _blake2.blake2b "BLAKE2bObject *" "&PyBlake2_BLAKE2bType" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6893358c6622aecf]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=d47b0527b39c673f]*/ static BLAKE2bObject * @@ -66,13 +66,14 @@ new_BLAKE2bObject(PyTypeObject *type) /*[clinic input] @classmethod -_blake2b.blake2b.__new__ as py_blake2b_new - string as data: object = NULL +_blake2.blake2b.__new__ as py_blake2b_new + data: object(c_default="NULL") = b'' + / * - digest_size: int(c_default="BLAKE2B_OUTBYTES") = _blake2b.blake2b.MAX_DIGEST_SIZE - key: Py_buffer = None - salt: Py_buffer = None - person: Py_buffer = None + digest_size: int(c_default="BLAKE2B_OUTBYTES") = _blake2.blake2b.MAX_DIGEST_SIZE + key: Py_buffer(c_default="NULL", py_default="b''") = None + salt: Py_buffer(c_default="NULL", py_default="b''") = None + person: Py_buffer(c_default="NULL", py_default="b''") = None fanout: int = 1 depth: int = 1 leaf_size: unsigned_long = 0 @@ -90,7 +91,7 @@ py_blake2b_new_impl(PyTypeObject *type, PyObject *data, int digest_size, int fanout, int depth, unsigned long leaf_size, unsigned long long node_offset, int node_depth, int inner_size, int last_node) -/*[clinic end generated code: output=65e732c66c2297a0 input=75ab5196b695adee]*/ +/*[clinic end generated code: output=65e732c66c2297a0 input=82be35a4e6a9daa2]*/ { BLAKE2bObject *self = NULL; Py_buffer buf; @@ -237,14 +238,14 @@ py_blake2b_new_impl(PyTypeObject *type, PyObject *data, int digest_size, } /*[clinic input] -_blake2b.blake2b.copy +_blake2.blake2b.copy Return a copy of the hash object. [clinic start generated code]*/ static PyObject * -_blake2b_blake2b_copy_impl(BLAKE2bObject *self) -/*[clinic end generated code: output=c89cd33550ab1543 input=4c9c319f18f10747]*/ +_blake2_blake2b_copy_impl(BLAKE2bObject *self) +/*[clinic end generated code: output=ff6acee5f93656ae input=e383c2d199fd8a2e]*/ { BLAKE2bObject *cpy; @@ -259,21 +260,21 @@ _blake2b_blake2b_copy_impl(BLAKE2bObject *self) } /*[clinic input] -_blake2b.blake2b.update +_blake2.blake2b.update - obj: object + data: object / -Update this hash object's state with the provided string. +Update this hash object's state with the provided bytes-like object. [clinic start generated code]*/ static PyObject * -_blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj) -/*[clinic end generated code: output=a888f07c4cddbe94 input=3ecb8c13ee4260f2]*/ +_blake2_blake2b_update(BLAKE2bObject *self, PyObject *data) +/*[clinic end generated code: output=010dfcbe22654359 input=ffc4aa6a6a225d31]*/ { Py_buffer buf; - GET_BUFFER_VIEW_OR_ERROUT(obj, &buf); + GET_BUFFER_VIEW_OR_ERROUT(data, &buf); if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) self->lock = PyThread_allocate_lock(); @@ -293,14 +294,14 @@ _blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj) } /*[clinic input] -_blake2b.blake2b.digest +_blake2.blake2b.digest -Return the digest value as a string of binary data. +Return the digest value as a bytes object. [clinic start generated code]*/ static PyObject * -_blake2b_blake2b_digest_impl(BLAKE2bObject *self) -/*[clinic end generated code: output=b13a79360d984740 input=ac2fa462ebb1b9c7]*/ +_blake2_blake2b_digest_impl(BLAKE2bObject *self) +/*[clinic end generated code: output=a5864660f4bfc61a input=7d21659e9c5fff02]*/ { uint8_t digest[BLAKE2B_OUTBYTES]; blake2b_state state_cpy; @@ -314,14 +315,14 @@ _blake2b_blake2b_digest_impl(BLAKE2bObject *self) } /*[clinic input] -_blake2b.blake2b.hexdigest +_blake2.blake2b.hexdigest Return the digest value as a string of hexadecimal digits. [clinic start generated code]*/ static PyObject * -_blake2b_blake2b_hexdigest_impl(BLAKE2bObject *self) -/*[clinic end generated code: output=6a503611715b24bd input=d58f0b2f37812e33]*/ +_blake2_blake2b_hexdigest_impl(BLAKE2bObject *self) +/*[clinic end generated code: output=b5598a87d8794a60 input=76930f6946351f56]*/ { uint8_t digest[BLAKE2B_OUTBYTES]; blake2b_state state_cpy; @@ -335,10 +336,10 @@ _blake2b_blake2b_hexdigest_impl(BLAKE2bObject *self) static PyMethodDef py_blake2b_methods[] = { - _BLAKE2B_BLAKE2B_COPY_METHODDEF - _BLAKE2B_BLAKE2B_DIGEST_METHODDEF - _BLAKE2B_BLAKE2B_HEXDIGEST_METHODDEF - _BLAKE2B_BLAKE2B_UPDATE_METHODDEF + _BLAKE2_BLAKE2B_COPY_METHODDEF + _BLAKE2_BLAKE2B_DIGEST_METHODDEF + _BLAKE2_BLAKE2B_HEXDIGEST_METHODDEF + _BLAKE2_BLAKE2B_UPDATE_METHODDEF {NULL, NULL} }; diff --git a/Modules/_blake2/blake2s_impl.c b/Modules/_blake2/blake2s_impl.c index 8c49082..8864fd8 100644 --- a/Modules/_blake2/blake2s_impl.c +++ b/Modules/_blake2/blake2s_impl.c @@ -47,10 +47,10 @@ typedef struct { #include "clinic/blake2s_impl.c.h" /*[clinic input] -module _blake2s -class _blake2s.blake2s "BLAKE2sObject *" "&PyBlake2_BLAKE2sType" +module _blake2 +class _blake2.blake2s "BLAKE2sObject *" "&PyBlake2_BLAKE2sType" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=edbfcf7557a685a7]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=4b79d7ffe07286ce]*/ static BLAKE2sObject * @@ -66,13 +66,14 @@ new_BLAKE2sObject(PyTypeObject *type) /*[clinic input] @classmethod -_blake2s.blake2s.__new__ as py_blake2s_new - string as data: object = NULL +_blake2.blake2s.__new__ as py_blake2s_new + data: object(c_default="NULL") = b'' + / * - digest_size: int(c_default="BLAKE2S_OUTBYTES") = _blake2s.blake2s.MAX_DIGEST_SIZE - key: Py_buffer = None - salt: Py_buffer = None - person: Py_buffer = None + digest_size: int(c_default="BLAKE2S_OUTBYTES") = _blake2.blake2s.MAX_DIGEST_SIZE + key: Py_buffer(c_default="NULL", py_default="b''") = None + salt: Py_buffer(c_default="NULL", py_default="b''") = None + person: Py_buffer(c_default="NULL", py_default="b''") = None fanout: int = 1 depth: int = 1 leaf_size: unsigned_long = 0 @@ -90,7 +91,7 @@ py_blake2s_new_impl(PyTypeObject *type, PyObject *data, int digest_size, int fanout, int depth, unsigned long leaf_size, unsigned long long node_offset, int node_depth, int inner_size, int last_node) -/*[clinic end generated code: output=b95806be0514dcf7 input=f18d6efd9b9a1271]*/ +/*[clinic end generated code: output=b95806be0514dcf7 input=641c0509debf714d]*/ { BLAKE2sObject *self = NULL; Py_buffer buf; @@ -237,14 +238,14 @@ py_blake2s_new_impl(PyTypeObject *type, PyObject *data, int digest_size, } /*[clinic input] -_blake2s.blake2s.copy +_blake2.blake2s.copy Return a copy of the hash object. [clinic start generated code]*/ static PyObject * -_blake2s_blake2s_copy_impl(BLAKE2sObject *self) -/*[clinic end generated code: output=6c5bada404b7aed7 input=c8858e887ae4a07a]*/ +_blake2_blake2s_copy_impl(BLAKE2sObject *self) +/*[clinic end generated code: output=5b90131c4eae275e input=0b9d44942f0fe4b2]*/ { BLAKE2sObject *cpy; @@ -259,21 +260,21 @@ _blake2s_blake2s_copy_impl(BLAKE2sObject *self) } /*[clinic input] -_blake2s.blake2s.update +_blake2.blake2s.update - obj: object + data: object / -Update this hash object's state with the provided string. +Update this hash object's state with the provided bytes-like object. [clinic start generated code]*/ static PyObject * -_blake2s_blake2s_update(BLAKE2sObject *self, PyObject *obj) -/*[clinic end generated code: output=fe8438a1d3cede87 input=47a408b9a3cc05c5]*/ +_blake2_blake2s_update(BLAKE2sObject *self, PyObject *data) +/*[clinic end generated code: output=757dc087fec37815 input=97500db2f9de4aaa]*/ { Py_buffer buf; - GET_BUFFER_VIEW_OR_ERROUT(obj, &buf); + GET_BUFFER_VIEW_OR_ERROUT(data, &buf); if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) self->lock = PyThread_allocate_lock(); @@ -293,14 +294,14 @@ _blake2s_blake2s_update(BLAKE2sObject *self, PyObject *obj) } /*[clinic input] -_blake2s.blake2s.digest +_blake2.blake2s.digest -Return the digest value as a string of binary data. +Return the digest value as a bytes object. [clinic start generated code]*/ static PyObject * -_blake2s_blake2s_digest_impl(BLAKE2sObject *self) -/*[clinic end generated code: output=80e81a48c6f79cf9 input=feb9a220135bdeba]*/ +_blake2_blake2s_digest_impl(BLAKE2sObject *self) +/*[clinic end generated code: output=40c566ca4bc6bc51 input=f41e0b8d6d937454]*/ { uint8_t digest[BLAKE2S_OUTBYTES]; blake2s_state state_cpy; @@ -314,14 +315,14 @@ _blake2s_blake2s_digest_impl(BLAKE2sObject *self) } /*[clinic input] -_blake2s.blake2s.hexdigest +_blake2.blake2s.hexdigest Return the digest value as a string of hexadecimal digits. [clinic start generated code]*/ static PyObject * -_blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self) -/*[clinic end generated code: output=db6c5028c0a3c2e5 input=4e4877b8bd7aea91]*/ +_blake2_blake2s_hexdigest_impl(BLAKE2sObject *self) +/*[clinic end generated code: output=15153eb5e59c52eb input=c77a1321567e8952]*/ { uint8_t digest[BLAKE2S_OUTBYTES]; blake2s_state state_cpy; @@ -335,10 +336,10 @@ _blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self) static PyMethodDef py_blake2s_methods[] = { - _BLAKE2S_BLAKE2S_COPY_METHODDEF - _BLAKE2S_BLAKE2S_DIGEST_METHODDEF - _BLAKE2S_BLAKE2S_HEXDIGEST_METHODDEF - _BLAKE2S_BLAKE2S_UPDATE_METHODDEF + _BLAKE2_BLAKE2S_COPY_METHODDEF + _BLAKE2_BLAKE2S_DIGEST_METHODDEF + _BLAKE2_BLAKE2S_HEXDIGEST_METHODDEF + _BLAKE2_BLAKE2S_UPDATE_METHODDEF {NULL, NULL} }; diff --git a/Modules/_blake2/clinic/blake2b_impl.c.h b/Modules/_blake2/clinic/blake2b_impl.c.h index 3cb70fb..3315bf9 100644 --- a/Modules/_blake2/clinic/blake2b_impl.c.h +++ b/Modules/_blake2/clinic/blake2b_impl.c.h @@ -3,10 +3,9 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(py_blake2b_new__doc__, -"blake2b(string=None, *, digest_size=_blake2b.blake2b.MAX_DIGEST_SIZE,\n" -" key=None, salt=None, person=None, fanout=1, depth=1,\n" -" leaf_size=0, node_offset=0, node_depth=0, inner_size=0,\n" -" last_node=False)\n" +"blake2b(data=b\'\', /, *, digest_size=_blake2.blake2b.MAX_DIGEST_SIZE,\n" +" key=b\'\', salt=b\'\', person=b\'\', fanout=1, depth=1, leaf_size=0,\n" +" node_offset=0, node_depth=0, inner_size=0, last_node=False)\n" "--\n" "\n" "Return a new BLAKE2b hash object."); @@ -22,7 +21,7 @@ static PyObject * py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL}; + static const char * const _keywords[] = {"", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL}; static _PyArg_Parser _parser = {"|O$iy*y*y*iiO&O&iip:blake2b", _keywords, 0}; PyObject *data = NULL; int digest_size = BLAKE2B_OUTBYTES; @@ -60,66 +59,66 @@ exit: return return_value; } -PyDoc_STRVAR(_blake2b_blake2b_copy__doc__, +PyDoc_STRVAR(_blake2_blake2b_copy__doc__, "copy($self, /)\n" "--\n" "\n" "Return a copy of the hash object."); -#define _BLAKE2B_BLAKE2B_COPY_METHODDEF \ - {"copy", (PyCFunction)_blake2b_blake2b_copy, METH_NOARGS, _blake2b_blake2b_copy__doc__}, +#define _BLAKE2_BLAKE2B_COPY_METHODDEF \ + {"copy", (PyCFunction)_blake2_blake2b_copy, METH_NOARGS, _blake2_blake2b_copy__doc__}, static PyObject * -_blake2b_blake2b_copy_impl(BLAKE2bObject *self); +_blake2_blake2b_copy_impl(BLAKE2bObject *self); static PyObject * -_blake2b_blake2b_copy(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2b_copy(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2b_blake2b_copy_impl(self); + return _blake2_blake2b_copy_impl(self); } -PyDoc_STRVAR(_blake2b_blake2b_update__doc__, -"update($self, obj, /)\n" +PyDoc_STRVAR(_blake2_blake2b_update__doc__, +"update($self, data, /)\n" "--\n" "\n" -"Update this hash object\'s state with the provided string."); +"Update this hash object\'s state with the provided bytes-like object."); -#define _BLAKE2B_BLAKE2B_UPDATE_METHODDEF \ - {"update", (PyCFunction)_blake2b_blake2b_update, METH_O, _blake2b_blake2b_update__doc__}, +#define _BLAKE2_BLAKE2B_UPDATE_METHODDEF \ + {"update", (PyCFunction)_blake2_blake2b_update, METH_O, _blake2_blake2b_update__doc__}, -PyDoc_STRVAR(_blake2b_blake2b_digest__doc__, +PyDoc_STRVAR(_blake2_blake2b_digest__doc__, "digest($self, /)\n" "--\n" "\n" -"Return the digest value as a string of binary data."); +"Return the digest value as a bytes object."); -#define _BLAKE2B_BLAKE2B_DIGEST_METHODDEF \ - {"digest", (PyCFunction)_blake2b_blake2b_digest, METH_NOARGS, _blake2b_blake2b_digest__doc__}, +#define _BLAKE2_BLAKE2B_DIGEST_METHODDEF \ + {"digest", (PyCFunction)_blake2_blake2b_digest, METH_NOARGS, _blake2_blake2b_digest__doc__}, static PyObject * -_blake2b_blake2b_digest_impl(BLAKE2bObject *self); +_blake2_blake2b_digest_impl(BLAKE2bObject *self); static PyObject * -_blake2b_blake2b_digest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2b_digest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2b_blake2b_digest_impl(self); + return _blake2_blake2b_digest_impl(self); } -PyDoc_STRVAR(_blake2b_blake2b_hexdigest__doc__, +PyDoc_STRVAR(_blake2_blake2b_hexdigest__doc__, "hexdigest($self, /)\n" "--\n" "\n" "Return the digest value as a string of hexadecimal digits."); -#define _BLAKE2B_BLAKE2B_HEXDIGEST_METHODDEF \ - {"hexdigest", (PyCFunction)_blake2b_blake2b_hexdigest, METH_NOARGS, _blake2b_blake2b_hexdigest__doc__}, +#define _BLAKE2_BLAKE2B_HEXDIGEST_METHODDEF \ + {"hexdigest", (PyCFunction)_blake2_blake2b_hexdigest, METH_NOARGS, _blake2_blake2b_hexdigest__doc__}, static PyObject * -_blake2b_blake2b_hexdigest_impl(BLAKE2bObject *self); +_blake2_blake2b_hexdigest_impl(BLAKE2bObject *self); static PyObject * -_blake2b_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2b_blake2b_hexdigest_impl(self); + return _blake2_blake2b_hexdigest_impl(self); } -/*[clinic end generated code: output=afc5c45dff0a24f9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=39c77de2142faa12 input=a9049054013a1b77]*/ diff --git a/Modules/_blake2/clinic/blake2s_impl.c.h b/Modules/_blake2/clinic/blake2s_impl.c.h index b444f7b..23d19ec 100644 --- a/Modules/_blake2/clinic/blake2s_impl.c.h +++ b/Modules/_blake2/clinic/blake2s_impl.c.h @@ -3,10 +3,9 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(py_blake2s_new__doc__, -"blake2s(string=None, *, digest_size=_blake2s.blake2s.MAX_DIGEST_SIZE,\n" -" key=None, salt=None, person=None, fanout=1, depth=1,\n" -" leaf_size=0, node_offset=0, node_depth=0, inner_size=0,\n" -" last_node=False)\n" +"blake2s(data=b\'\', /, *, digest_size=_blake2.blake2s.MAX_DIGEST_SIZE,\n" +" key=b\'\', salt=b\'\', person=b\'\', fanout=1, depth=1, leaf_size=0,\n" +" node_offset=0, node_depth=0, inner_size=0, last_node=False)\n" "--\n" "\n" "Return a new BLAKE2s hash object."); @@ -22,7 +21,7 @@ static PyObject * py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL}; + static const char * const _keywords[] = {"", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL}; static _PyArg_Parser _parser = {"|O$iy*y*y*iiO&O&iip:blake2s", _keywords, 0}; PyObject *data = NULL; int digest_size = BLAKE2S_OUTBYTES; @@ -60,66 +59,66 @@ exit: return return_value; } -PyDoc_STRVAR(_blake2s_blake2s_copy__doc__, +PyDoc_STRVAR(_blake2_blake2s_copy__doc__, "copy($self, /)\n" "--\n" "\n" "Return a copy of the hash object."); -#define _BLAKE2S_BLAKE2S_COPY_METHODDEF \ - {"copy", (PyCFunction)_blake2s_blake2s_copy, METH_NOARGS, _blake2s_blake2s_copy__doc__}, +#define _BLAKE2_BLAKE2S_COPY_METHODDEF \ + {"copy", (PyCFunction)_blake2_blake2s_copy, METH_NOARGS, _blake2_blake2s_copy__doc__}, static PyObject * -_blake2s_blake2s_copy_impl(BLAKE2sObject *self); +_blake2_blake2s_copy_impl(BLAKE2sObject *self); static PyObject * -_blake2s_blake2s_copy(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2s_copy(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2s_blake2s_copy_impl(self); + return _blake2_blake2s_copy_impl(self); } -PyDoc_STRVAR(_blake2s_blake2s_update__doc__, -"update($self, obj, /)\n" +PyDoc_STRVAR(_blake2_blake2s_update__doc__, +"update($self, data, /)\n" "--\n" "\n" -"Update this hash object\'s state with the provided string."); +"Update this hash object\'s state with the provided bytes-like object."); -#define _BLAKE2S_BLAKE2S_UPDATE_METHODDEF \ - {"update", (PyCFunction)_blake2s_blake2s_update, METH_O, _blake2s_blake2s_update__doc__}, +#define _BLAKE2_BLAKE2S_UPDATE_METHODDEF \ + {"update", (PyCFunction)_blake2_blake2s_update, METH_O, _blake2_blake2s_update__doc__}, -PyDoc_STRVAR(_blake2s_blake2s_digest__doc__, +PyDoc_STRVAR(_blake2_blake2s_digest__doc__, "digest($self, /)\n" "--\n" "\n" -"Return the digest value as a string of binary data."); +"Return the digest value as a bytes object."); -#define _BLAKE2S_BLAKE2S_DIGEST_METHODDEF \ - {"digest", (PyCFunction)_blake2s_blake2s_digest, METH_NOARGS, _blake2s_blake2s_digest__doc__}, +#define _BLAKE2_BLAKE2S_DIGEST_METHODDEF \ + {"digest", (PyCFunction)_blake2_blake2s_digest, METH_NOARGS, _blake2_blake2s_digest__doc__}, static PyObject * -_blake2s_blake2s_digest_impl(BLAKE2sObject *self); +_blake2_blake2s_digest_impl(BLAKE2sObject *self); static PyObject * -_blake2s_blake2s_digest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2s_digest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2s_blake2s_digest_impl(self); + return _blake2_blake2s_digest_impl(self); } -PyDoc_STRVAR(_blake2s_blake2s_hexdigest__doc__, +PyDoc_STRVAR(_blake2_blake2s_hexdigest__doc__, "hexdigest($self, /)\n" "--\n" "\n" "Return the digest value as a string of hexadecimal digits."); -#define _BLAKE2S_BLAKE2S_HEXDIGEST_METHODDEF \ - {"hexdigest", (PyCFunction)_blake2s_blake2s_hexdigest, METH_NOARGS, _blake2s_blake2s_hexdigest__doc__}, +#define _BLAKE2_BLAKE2S_HEXDIGEST_METHODDEF \ + {"hexdigest", (PyCFunction)_blake2_blake2s_hexdigest, METH_NOARGS, _blake2_blake2s_hexdigest__doc__}, static PyObject * -_blake2s_blake2s_hexdigest_impl(BLAKE2sObject *self); +_blake2_blake2s_hexdigest_impl(BLAKE2sObject *self); static PyObject * -_blake2s_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) +_blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored)) { - return _blake2s_blake2s_hexdigest_impl(self); + return _blake2_blake2s_hexdigest_impl(self); } -/*[clinic end generated code: output=b705723d16f21f57 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a31a1d56f0e0781f input=a9049054013a1b77]*/ |