mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters. Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`, while the documentation expected `data` to be given in all cases. (cherry picked from commitc6e63d9d35
) (cherry picked from commit379d0bc956
)
This commit is contained in:
parent
e69ecfee5e
commit
2c325e28c3
18 changed files with 929 additions and 500 deletions
|
@ -269,17 +269,24 @@ static PyType_Spec md5_type_spec = {
|
|||
/*[clinic input]
|
||||
_md5.md5
|
||||
|
||||
string: object(c_default="NULL") = b''
|
||||
data: object(c_default="NULL") = b''
|
||||
*
|
||||
usedforsecurity: bool = True
|
||||
string as string_obj: object(c_default="NULL") = None
|
||||
|
||||
Return a new MD5 hash object; optionally initialized with a string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_md5_md5_impl(PyObject *module, PyObject *string, int usedforsecurity)
|
||||
/*[clinic end generated code: output=587071f76254a4ac input=7a144a1905636985]*/
|
||||
_md5_md5_impl(PyObject *module, PyObject *data, int usedforsecurity,
|
||||
PyObject *string_obj)
|
||||
/*[clinic end generated code: output=d45e187d3d16f3a8 input=7ea5c5366dbb44bf]*/
|
||||
{
|
||||
PyObject *string;
|
||||
if (_Py_hashlib_data_argument(&string, data, string_obj) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MD5object *new;
|
||||
Py_buffer buf;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue