[pypy-svn] r62809 - pypy/trunk/pypy/lib

afa at codespeak.net afa at codespeak.net
Tue Mar 10 13:22:53 CET 2009


Author: afa
Date: Tue Mar 10 13:22:51 2009
New Revision: 62809

Added:
   pypy/trunk/pypy/lib/_sha512.py
      - copied, changed from r62808, pypy/dist/pypy/lib/_sha512.py
Modified:
   pypy/trunk/pypy/lib/hashlib.py
Log:
Merge the pure-python _sha512 module provided by hruske.

Thanks!
test_hashlib now passes on Windows.


Copied: pypy/trunk/pypy/lib/_sha512.py (from r62808, pypy/dist/pypy/lib/_sha512.py)
==============================================================================
--- pypy/dist/pypy/lib/_sha512.py	(original)
+++ pypy/trunk/pypy/lib/_sha512.py	Tue Mar 10 13:22:51 2009
@@ -143,7 +143,7 @@
     sha_info['digestsize'] = 64
     return sha_info
 
-def sha384_init(sha_info):
+def sha384_init():
     sha_info = new_shaobject()
     sha_info['digest'] = [ 0xcbbb9d5dc1059ed8, 0x629a292a367cd507, 0x9159015a3070dd17, 0x152fecd8f70e5939, 0x67332667ffc00b31, 0x8eb44a8768581511, 0xdb0c2e0d64f98fa7, 0x47b5481dbefa4fa4]
     sha_info['count_lo'] = 0

Modified: pypy/trunk/pypy/lib/hashlib.py
==============================================================================
--- pypy/trunk/pypy/lib/hashlib.py	(original)
+++ pypy/trunk/pypy/lib/hashlib.py	Tue Mar 10 13:22:51 2009
@@ -68,6 +68,12 @@
     elif name in ('SHA224', 'sha224'):
         import _sha256
         return _sha256.sha224
+    elif name in ('SHA512', 'sha512'):
+        import _sha512
+        return _sha512.sha512
+    elif name in ('SHA384', 'sha384'):
+        import _sha512
+        return _sha512.sha384
     raise ValueError, "unsupported hash type"
 
 def __hash_new(name, string=''):
@@ -118,5 +124,5 @@
     sha1 = __get_builtin_constructor('sha1')
     sha224 = __get_builtin_constructor('sha224')
     sha256 = __get_builtin_constructor('sha256')
-    #sha384 = __get_builtin_constructor('sha384')
-    #sha512 = __get_builtin_constructor('sha512')
+    sha384 = __get_builtin_constructor('sha384')
+    sha512 = __get_builtin_constructor('sha512')



More information about the Pypy-commit mailing list