Browse code

* S3/S3.py, S3/Utils.py: Use 'hashlib' instead of md5 and sha modules to avoid Python 2.6 warnings.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@323 830e0280-6d2a-0410-9c65-932aecc39d9d

W. Tell authored on 2008/12/31 21:47:01
Showing 3 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 2009-01-01  W. Tell  <w_tell -at- sourceforge>
2 2
 
3 3
 	* S3/S3.py, S3/Utils.py: Use 'hashlib' instead of md5 and sha 
4
-	  modules to avoid Python 2.6 warnings.
4
+	  modules to avoid Python 2.6 warnings. 
5 5
 
6 6
 2008-12-31  Michal Ludvig  <michal@logix.cz>
7 7
 
... ...
@@ -16,8 +16,8 @@ from stat import ST_SIZE
16 16
 try:
17 17
 	from hashlib import md5, sha1
18 18
 except ImportError:
19
-	import md5
20
-	import sha as sha1
19
+	from md5 import md5
20
+	from sha import sha as sha1
21 21
 import hmac
22 22
 
23 23
 from Utils import *
... ...
@@ -9,9 +9,9 @@ import re
9 9
 import string
10 10
 import random
11 11
 try:
12
-	import hashlib as hash
12
+	from hashlib import md5
13 13
 except ImportError:
14
-	import md5 as hash
14
+	from md5 import md5
15 15
 import errno
16 16
 
17 17
 from logging import debug, info, warning, error
... ...
@@ -149,7 +149,7 @@ def mktmpfile(prefix = "/tmp/tmpfile-", randchars = 20):
149 149
 	return mktmpsomething(prefix, randchars, createfunc)
150 150
 
151 151
 def hash_file_md5(filename):
152
-	h = hash.md5()
152
+	h = md5()
153 153
 	f = open(filename, "rb")
154 154
 	while True:
155 155
 		# Hash 32kB chunks