Fix sha depreceated warning for python 2.6
This commit is contained in:
+3
-3
@@ -17,7 +17,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import sha
|
import hashlib
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
import fnmatch
|
import fnmatch
|
||||||
@@ -397,7 +397,7 @@ def sha1_file(filename):
|
|||||||
"""Calculate sha1 hash of file."""
|
"""Calculate sha1 hash of file."""
|
||||||
# Broken links can cause problem!
|
# Broken links can cause problem!
|
||||||
try:
|
try:
|
||||||
m = sha.new()
|
m = hashlib.sha1()
|
||||||
f = file(filename, 'rb')
|
f = file(filename, 'rb')
|
||||||
while True:
|
while True:
|
||||||
# 256 KB seems ideal for speed/memory tradeoff
|
# 256 KB seems ideal for speed/memory tradeoff
|
||||||
@@ -418,7 +418,7 @@ def sha1_file(filename):
|
|||||||
|
|
||||||
def sha1_data(data):
|
def sha1_data(data):
|
||||||
"""Calculate sha1 hash of given data."""
|
"""Calculate sha1 hash of given data."""
|
||||||
m = sha.new()
|
m = hashlib.sha1()
|
||||||
m.update(data)
|
m.update(data)
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user