]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport akuchling's patch:
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 03:47:40 +0000 (03:47 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 03:47:40 +0000 (03:47 +0000)
Use 2.1's .hexdigest() method

Tools/scripts/md5sum.py

index ac2eac0cb6821ad66f3c162078e46c5cfd213bc8..1bacdf2369d668f92651295df5d872fa8e1f8ddd 100644 (file)
@@ -2,16 +2,13 @@
 
 """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
 
 BLOCKSIZE = 1024*1024
 
-def hexify(s):
-    return ("%02x"*len(s)) % tuple(map(ord, s))
-
 def main():
     args = sys.argv[1:]
     if not args:
@@ -26,7 +23,7 @@ def main():
                 break
             sum.update(block)
         f.close()
-        print hexify(sum.digest()), file
+        print sum.hexdigest(), file
 
 if __name__ == "__main__":
     main()