Use 2.1's .hexdigest() method
This commit is contained in:
parent
2ee4be0775
commit
343cbd0279
@ -2,16 +2,13 @@
|
|||||||
|
|
||||||
"""Python utility to print MD5 checksums of argument files.
|
"""Python utility to print MD5 checksums of argument files.
|
||||||
|
|
||||||
Works with Python 1.5.2 and later.
|
Works with Python 2.1 and later.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys, md5
|
import sys, md5
|
||||||
|
|
||||||
BLOCKSIZE = 1024*1024
|
BLOCKSIZE = 1024*1024
|
||||||
|
|
||||||
def hexify(s):
|
|
||||||
return ("%02x"*len(s)) % tuple(map(ord, s))
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
if not args:
|
if not args:
|
||||||
@ -26,7 +23,7 @@ def main():
|
|||||||
break
|
break
|
||||||
sum.update(block)
|
sum.update(block)
|
||||||
f.close()
|
f.close()
|
||||||
print hexify(sum.digest()), file
|
print sum.hexdigest(), file
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user