diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2005-08-21 18:45:59 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2005-08-21 18:45:59 (GMT) |
commit | f21a5f773964d34c7b6deb7e3d753fae2b9c70e2 (patch) | |
tree | ba3b66cea11da1d8e930555aa5a10f775a285d84 /setup.py | |
parent | 33a5f2af59ddcf3f1b0447a8dbd0576fd78de303 (diff) | |
download | cpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.zip cpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.tar.gz cpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.tar.bz2 |
[ sf.net patch # 1121611 ]
A new hashlib module to replace the md5 and sha modules. It adds
support for additional secure hashes such as SHA-256 and SHA-512. The
hashlib module uses OpenSSL for fast platform optimized
implementations of algorithms when available. The old md5 and sha
modules still exist as wrappers around hashlib to preserve backwards
compatibility.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -400,15 +400,6 @@ class PyBuildExt(build_ext): # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) - # The md5 module implements the RSA Data Security, Inc. MD5 - # Message-Digest Algorithm, described in RFC 1321. The - # necessary files md5c.c and md5.h are included here. - exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) - - # The sha module implements the SHA checksum algorithm. - # (NIST's Secure Hash Algorithm.) - exts.append( Extension('sha', ['shamodule.c']) ) - # Helper module for various ascii-encoders exts.append( Extension('binascii', ['binascii.c']) ) @@ -506,6 +497,32 @@ class PyBuildExt(build_ext): libraries = ['ssl', 'crypto'], depends = ['socketmodule.h']), ) + if (ssl_incs is not None and + ssl_libs is not None): + # The _hashlib module wraps optimized implementations + # of hash functions from the OpenSSL library. + exts.append( Extension('_hashlib', ['_hashopenssl.c'], + include_dirs = ssl_incs, + library_dirs = ssl_libs, + libraries = ['ssl', 'crypto']) ) + else: + # The _sha module implements the SHA1 hash algorithm. + exts.append( Extension('_sha', ['shamodule.c']) ) + # The _md5 module implements the RSA Data Security, Inc. MD5 + # Message-Digest Algorithm, described in RFC 1321. The + # necessary files md5c.c and md5.h are included here. + exts.append( Extension('_md5', ['md5module.c', 'md5c.c']) ) + + # always compile these for now under the assumption that + # OpenSSL does not support them (it doesn't in common OpenSSL + # 0.9.7e installs at the time of this writing; OpenSSL 0.9.8 + # does). In the future we could make this conditional on + # OpenSSL version or support. The hashlib module uses the + # better implementation regardless. + exts.append( Extension('_sha256', ['sha256module.c']) ) + exts.append( Extension('_sha512', ['sha512module.c']) ) + + # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on # your machine, though none are defined by default because of library |