Skip to content

Commit c0b5daf

Browse files
committed
add _hashlib with support for everything but sha224, via
java.security.MessageDigest. supersedes our md5 module
1 parent f361041 commit c0b5daf

8 files changed

Lines changed: 248 additions & 543 deletions

File tree

CPythonLib.includes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ macurl2path.py
7777
mailbox.py
7878
mailcap.py
7979
markupbase.py
80+
md5.py
8081
mhlib.py
8182
mimetools.py
8283
mimetypes.py
@@ -113,6 +114,7 @@ repr.py
113114
rfc822.py
114115
rlcompleter.py
115116
sched.py
117+
sha.py
116118
sets.py
117119
sgmllib.py
118120
shelve.py

CoreExposed.includes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ org/python/core/PyXRange.class
3838
org/python/modules/_weakref/CallableProxyType.class
3939
org/python/modules/_weakref/ReferenceType.class
4040
org/python/modules/_weakref/ProxyType.class
41+
org/python/modules/_hashlib$Hash.class
4142
org/python/modules/collections/PyDefaultDict.class
4243
org/python/modules/collections/PyDeque.class
4344
org/python/modules/operator$PyAttrGetter.class

Lib/test/test_hashlib.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ def test_case_sha512_3(self):
184184

185185

186186
def test_main():
187+
if test_support.is_jython:
188+
# Java has no builtin support for sha224
189+
hashes = [hash for hash in HashLibTestCase.supported_hash_names
190+
if hash.lower() != 'sha224']
191+
HashLibTestCase.supported_hash_names = tuple(hashes)
192+
del HashLibTestCase.test_case_sha224_0
193+
del HashLibTestCase.test_case_sha224_1
194+
del HashLibTestCase.test_case_sha224_2
195+
del HashLibTestCase.test_case_sha224_3
196+
187197
test_support.run_unittest(HashLibTestCase)
188198

189199

src/org/python/modules/MD5Module.java

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/org/python/modules/MD5Object.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/org/python/modules/Setup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public class Setup
3838
"cStringIO",
3939
"struct",
4040
"binascii",
41-
"md5:org.python.modules.MD5Module",
4241
"exceptions:org.python.core.exceptions",
4342
"_codecs",
4443
"imp",
@@ -55,6 +54,7 @@ public class Setup
5554
"itertools",
5655
"zipimport:org.python.modules.zipimport.zipimport",
5756
"collections:org.python.modules.collections.Collections",
58-
"gc"
57+
"gc",
58+
"_hashlib"
5959
};
6060
}

0 commit comments

Comments
 (0)