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 |