Show More
@@ -26,6 +26,7 b' This can be used instead of tools like:' | |||
|
26 | 26 | from __future__ import absolute_import |
|
27 | 27 | |
|
28 | 28 | import glob |
|
29 | import hashlib | |
|
29 | 30 | import optparse |
|
30 | 31 | import os |
|
31 | 32 | import re |
@@ -80,17 +81,11 b' def visit(opts, filenames, outfile):' | |||
|
80 | 81 | else: |
|
81 | 82 | facts.append('older than %s' % opts.newer) |
|
82 | 83 | if opts.md5 and content is not None: |
|
83 | try: | |
|
84 | from hashlib import md5 | |
|
85 | except ImportError: | |
|
86 | from md5 import md5 | |
|
87 | facts.append('md5=%s' % md5(content).hexdigest()[:opts.bytes]) | |
|
84 | h = hashlib.md5(content) | |
|
85 | facts.append('md5=%s' % h.hexdigest()[:opts.bytes]) | |
|
88 | 86 | if opts.sha1 and content is not None: |
|
89 | try: | |
|
90 | from hashlib import sha1 | |
|
91 | except ImportError: | |
|
92 | from sha import sha as sha1 | |
|
93 | facts.append('sha1=%s' % sha1(content).hexdigest()[:opts.bytes]) | |
|
87 | h = hashlib.sha1(content) | |
|
88 | facts.append('sha1=%s' % h.hexdigest()[:opts.bytes]) | |
|
94 | 89 | if isstdin: |
|
95 | 90 | outfile.write(', '.join(facts) + '\n') |
|
96 | 91 | elif facts: |
General Comments 0
You need to be logged in to leave comments.
Login now