[pypy-svn] r60925 - pypy/trunk/pypy/lib
antocuni at codespeak.net
antocuni at codespeak.net
Tue Jan 13 17:10:37 CET 2009
Author: antocuni
Date: Tue Jan 13 17:10:36 2009
New Revision: 60925
Modified:
pypy/trunk/pypy/lib/_hashlib.py
Log:
(antocuni, arigato around)
on some systems EVP_MD_CTX_block_size is a macro, so we can't really call it
through ctypes. Instead, hardcode the result, as it is fixed given the hash
function
Modified: pypy/trunk/pypy/lib/_hashlib.py
==============================================================================
--- pypy/trunk/pypy/lib/_hashlib.py (original)
+++ pypy/trunk/pypy/lib/_hashlib.py Tue Jan 13 17:10:36 2009
@@ -115,7 +115,17 @@
digestsize = digest_size # deprecated, was once defined by sha module
def block_size(self):
- return lib.EVP_MD_CTX_block_size(byref(self._obj))
+ # XXX This isn't the nicest way, but the EVP_MD_CTX_block_size OpenSSL function
+ # XXX is defined as a C macro on some systems and would be significantly
+ # XXX harder to implement in another way.
+ return {
+ 'md5': 64,
+ 'sha1': 64,
+ 'sha224': 64,
+ 'sha256': 64,
+ 'sha384': 128,
+ 'sha512': 128,
+ }.get(self.name, 0)
block_size = property(block_size, None, None)
def update(self, string):
More information about the Pypy-commit
mailing list