Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
37d5cebb
Commit
37d5cebb
authored
Aug 15, 2013
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the builtin hash algorithms' names to lower case names
as promised by hashlib's documentation.
parent
f0e52103
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
8 deletions
+11
-8
Lib/test/test_hashlib.py
Lib/test/test_hashlib.py
+2
-2
Misc/NEWS
Misc/NEWS
+3
-0
Modules/md5module.c
Modules/md5module.c
+1
-1
Modules/sha1module.c
Modules/sha1module.c
+1
-1
Modules/sha256module.c
Modules/sha256module.c
+2
-2
Modules/sha512module.c
Modules/sha512module.c
+2
-2
No files found.
Lib/test/test_hashlib.py
View file @
37d5cebb
...
...
@@ -233,9 +233,9 @@ class HashLibTestCase(unittest.TestCase):
self
.
assertEqual
(
m
.
block_size
,
block_size
)
self
.
assertEqual
(
m
.
digest_size
,
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
self
.
assertIn
(
name
.
split
(
"_"
)[
0
],
repr
(
m
)
.
lower
()
)
self
.
assertIn
(
name
.
split
(
"_"
)[
0
],
repr
(
m
))
def
test_blocksize_name
(
self
):
self
.
check_blocksize_name
(
'md5'
,
64
,
16
)
...
...
Misc/NEWS
View file @
37d5cebb
...
...
@@ -28,6 +28,9 @@ Core and Builtins
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 #12015: The tempfile module now uses a suffix of 8 random characters
...
...
Modules/md5module.c
View file @
37d5cebb
...
...
@@ -439,7 +439,7 @@ MD5_get_block_size(PyObject *self, void *closure)
static
PyObject
*
MD5_get_name
(
PyObject
*
self
,
void
*
closure
)
{
return
PyUnicode_FromStringAndSize
(
"
MD
5"
,
3
);
return
PyUnicode_FromStringAndSize
(
"
md
5"
,
3
);
}
static
PyObject
*
...
...
Modules/sha1module.c
View file @
37d5cebb
...
...
@@ -411,7 +411,7 @@ SHA1_get_block_size(PyObject *self, void *closure)
static
PyObject
*
SHA1_get_name
(
PyObject
*
self
,
void
*
closure
)
{
return
PyUnicode_FromStringAndSize
(
"
SHA
1"
,
4
);
return
PyUnicode_FromStringAndSize
(
"
sha
1"
,
4
);
}
static
PyObject
*
...
...
Modules/sha256module.c
View file @
37d5cebb
...
...
@@ -501,9 +501,9 @@ static PyObject *
SHA256_get_name
(
PyObject
*
self
,
void
*
closure
)
{
if
(((
SHAobject
*
)
self
)
->
digestsize
==
32
)
return
PyUnicode_FromStringAndSize
(
"
SHA
256"
,
6
);
return
PyUnicode_FromStringAndSize
(
"
sha
256"
,
6
);
else
return
PyUnicode_FromStringAndSize
(
"
SHA
224"
,
6
);
return
PyUnicode_FromStringAndSize
(
"
sha
224"
,
6
);
}
static
PyGetSetDef
SHA_getseters
[]
=
{
...
...
Modules/sha512module.c
View file @
37d5cebb
...
...
@@ -567,9 +567,9 @@ static PyObject *
SHA512_get_name
(
PyObject
*
self
,
void
*
closure
)
{
if
(((
SHAobject
*
)
self
)
->
digestsize
==
64
)
return
PyUnicode_FromStringAndSize
(
"
SHA
512"
,
6
);
return
PyUnicode_FromStringAndSize
(
"
sha
512"
,
6
);
else
return
PyUnicode_FromStringAndSize
(
"
SHA
384"
,
6
);
return
PyUnicode_FromStringAndSize
(
"
sha
384"
,
6
);
}
static
PyGetSetDef
SHA_getseters
[]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment