View | Details | Raw Unified | Return to bug 23581
Collapse All | Expand All

(-)pycrypto-2.0.old/Hash/MD5.py (-8 / +16 lines)
Lines 1-13 Link Here
1
1
2
# Just use the MD5 module from the Python standard library
2
# Just use the MD5 module from the Python standard library
3
# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2
4
__revision__ = "$Id"
3
5
4
__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
6
__all__ = ['new', 'digest_size']
5
7
6
from md5 import *
8
try:
7
9
    # The md5 module is deprecated in Python 2.6, so use hashlib when possible.
8
import md5
10
    import hashlib
9
if hasattr(md5, 'digestsize'):
11
    def new(data=""):
10
    digest_size = digestsize
12
        return hashlib.md5(data)
11
    del digestsize
13
    digest_size = new().digest_size
12
del md5
14
except ImportError:
15
    from md5 import *
13
16
17
    import md5
18
    if hasattr(md5, 'digestsize'):
19
        digest_size = digestsize
20
        del digestsize
21
    del md5
(-)pycrypto-2.0.old/Hash/SHA.py (-7 / +17 lines)
Lines 1-11 Link Here
1
1
2
# Just use the SHA module from the Python standard library
2
# Just use the SHA module from the Python standard library
3
# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2
4
__revision__ = "$Id$"
3
5
4
__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
6
__all__ = ['new', 'digest_size']
5
7
6
from sha import *
8
try:
7
import sha
9
    # The md5 module is deprecated in Python 2.6, so use hashlib when possible.
8
if hasattr(sha, 'digestsize'):
10
    import hashlib
9
    digest_size = digestsize
11
    def new(data=""):
10
    del digestsize
12
        return hashlib.sha1(data)
11
del sha
13
    digest_size = new().digest_size
14
15
except ImportError:
16
    from sha import *
17
    import sha
18
    if hasattr(sha, 'digestsize'):
19
        digest_size = digestsize
20
        del digestsize
21
    del sha

Return to bug 23581