Kaydet (Commit) 37d5cebb authored tarafından Christian Heimes's avatar Christian Heimes

Change the builtin hash algorithms' names to lower case names

as promised by hashlib's documentation.
üst f0e52103
...@@ -233,9 +233,9 @@ class HashLibTestCase(unittest.TestCase): ...@@ -233,9 +233,9 @@ class HashLibTestCase(unittest.TestCase):
self.assertEqual(m.block_size, block_size) self.assertEqual(m.block_size, block_size)
self.assertEqual(m.digest_size, digest_size) self.assertEqual(m.digest_size, digest_size)
self.assertEqual(len(m.digest()), digest_size) self.assertEqual(len(m.digest()), digest_size)
self.assertEqual(m.name.lower(), name.lower()) self.assertEqual(m.name, name)
# split for sha3_512 / _sha3.sha3 object # split for sha3_512 / _sha3.sha3 object
self.assertIn(name.split("_")[0], repr(m).lower()) self.assertIn(name.split("_")[0], repr(m))
def test_blocksize_name(self): def test_blocksize_name(self):
self.check_blocksize_name('md5', 64, 16) self.check_blocksize_name('md5', 64, 16)
......
...@@ -28,6 +28,9 @@ Core and Builtins ...@@ -28,6 +28,9 @@ Core and Builtins
Library Library
------- -------
- Issue #18532: Change the builtin hash algorithms' names to lower case names
as promised by hashlib's documentation.
- Issue #18405: Improve the entropy of crypt.mksalt(). - Issue #18405: Improve the entropy of crypt.mksalt().
- Issue #12015: The tempfile module now uses a suffix of 8 random characters - Issue #12015: The tempfile module now uses a suffix of 8 random characters
......
...@@ -439,7 +439,7 @@ MD5_get_block_size(PyObject *self, void *closure) ...@@ -439,7 +439,7 @@ MD5_get_block_size(PyObject *self, void *closure)
static PyObject * static PyObject *
MD5_get_name(PyObject *self, void *closure) MD5_get_name(PyObject *self, void *closure)
{ {
return PyUnicode_FromStringAndSize("MD5", 3); return PyUnicode_FromStringAndSize("md5", 3);
} }
static PyObject * static PyObject *
......
...@@ -411,7 +411,7 @@ SHA1_get_block_size(PyObject *self, void *closure) ...@@ -411,7 +411,7 @@ SHA1_get_block_size(PyObject *self, void *closure)
static PyObject * static PyObject *
SHA1_get_name(PyObject *self, void *closure) SHA1_get_name(PyObject *self, void *closure)
{ {
return PyUnicode_FromStringAndSize("SHA1", 4); return PyUnicode_FromStringAndSize("sha1", 4);
} }
static PyObject * static PyObject *
......
...@@ -501,9 +501,9 @@ static PyObject * ...@@ -501,9 +501,9 @@ static PyObject *
SHA256_get_name(PyObject *self, void *closure) SHA256_get_name(PyObject *self, void *closure)
{ {
if (((SHAobject *)self)->digestsize == 32) if (((SHAobject *)self)->digestsize == 32)
return PyUnicode_FromStringAndSize("SHA256", 6); return PyUnicode_FromStringAndSize("sha256", 6);
else else
return PyUnicode_FromStringAndSize("SHA224", 6); return PyUnicode_FromStringAndSize("sha224", 6);
} }
static PyGetSetDef SHA_getseters[] = { static PyGetSetDef SHA_getseters[] = {
......
...@@ -567,9 +567,9 @@ static PyObject * ...@@ -567,9 +567,9 @@ static PyObject *
SHA512_get_name(PyObject *self, void *closure) SHA512_get_name(PyObject *self, void *closure)
{ {
if (((SHAobject *)self)->digestsize == 64) if (((SHAobject *)self)->digestsize == 64)
return PyUnicode_FromStringAndSize("SHA512", 6); return PyUnicode_FromStringAndSize("sha512", 6);
else else
return PyUnicode_FromStringAndSize("SHA384", 6); return PyUnicode_FromStringAndSize("sha384", 6);
} }
static PyGetSetDef SHA_getseters[] = { static PyGetSetDef SHA_getseters[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment