Update pactest to use hashlib
The md5 module is deprecated in favor of hashlib. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
f57f8d3386
commit
9d661240fe
1 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import md5
|
import hashlib
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ def getmd5sum(filename):
|
||||||
print "file %s does not exist!" % filename
|
print "file %s does not exist!" % filename
|
||||||
return ""
|
return ""
|
||||||
fd = open(filename, "rb")
|
fd = open(filename, "rb")
|
||||||
checksum = md5.new()
|
checksum = hashlib.md5()
|
||||||
while 1:
|
while 1:
|
||||||
block = fd.read(1048576)
|
block = fd.read(1048576)
|
||||||
if not block:
|
if not block:
|
||||||
|
@ -211,7 +211,7 @@ def getmd5sum(filename):
|
||||||
def mkmd5sum(data):
|
def mkmd5sum(data):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
checksum = md5.new()
|
checksum = hashlib.md5()
|
||||||
checksum.update("%s\n" % data)
|
checksum.update("%s\n" % data)
|
||||||
digest = checksum.digest()
|
digest = checksum.digest()
|
||||||
return "%02x"*len(digest) % tuple(map(ord, digest))
|
return "%02x"*len(digest) % tuple(map(ord, digest))
|
||||||
|
|
Loading…
Add table
Reference in a new issue