| Previous | 199869 Revisions | Next |
| r36293 Friday 6th March, 2015 at 20:18:30 UTC by Mike Naberezny |
|---|
| chdtest.py: Open as binary, read in chunks to reduce memory usage. (nw) |
| [src/regtests/chdman] | chdtest.py |
| r244804 | r244805 | |
|---|---|---|
| 30 | 30 | def sha1sum(path): |
| 31 | 31 | if not os.path.exists(path): |
| 32 | 32 | return "" |
| 33 | sha1 = hashlib.sha1() | |
| 34 | f = open(path, 'r') | |
| 35 | sha1.update(f.read()) | |
| 36 | f.close() | |
| 33 | f = open(path, 'rb') | |
| 34 | try: | |
| 35 | sha1 = hashlib.sha1() | |
| 36 | while True: | |
| 37 | data = f.read(8192) | |
| 38 | if data: | |
| 39 | sha1.update(data) | |
| 40 | else: | |
| 41 | break | |
| 42 | finally: | |
| 43 | f.close() | |
| 37 | 44 | return sha1.hexdigest() |
| 38 | 45 | |
| 39 | 46 | def extractcdAndCompare(type): |
| https://github.com/mamedev/mame/commit/b32c98689f1093fb2febcccd73a13e426df44350 |
| Previous | 199869 Revisions | Next |