Show More
@@ -211,15 +211,12 b" The '-t' should override autodetection" | |||||
211 | > done |
|
211 | > done | |
212 |
|
212 | |||
213 | $ cat > md5comp.py <<EOF |
|
213 | $ cat > md5comp.py <<EOF | |
214 | > from __future__ import print_function |
|
214 | > from __future__ import absolute_import, print_function | |
215 | > try: |
|
215 | > import hashlib | |
216 | > from hashlib import md5 |
|
|||
217 | > except ImportError: |
|
|||
218 | > from md5 import md5 |
|
|||
219 | > import sys |
|
216 | > import sys | |
220 | > f1, f2 = sys.argv[1:3] |
|
217 | > f1, f2 = sys.argv[1:3] | |
221 | > h1 = md5(open(f1, 'rb').read()).hexdigest() |
|
218 | > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest() | |
222 | > h2 = md5(open(f2, 'rb').read()).hexdigest() |
|
219 | > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest() | |
223 | > print(h1 == h2 or "md5 differ: " + repr((h1, h2))) |
|
220 | > print(h1 == h2 or "md5 differ: " + repr((h1, h2))) | |
224 | > EOF |
|
221 | > EOF | |
225 |
|
222 |
General Comments 0
You need to be logged in to leave comments.
Login now