| Conditions | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/python |
||
| 10 | def digest(self, filename): |
||
| 11 | """Determine the unique hash digest for a file. |
||
| 12 | |||
| 13 | Note: takes 26s for a 14GB file. |
||
| 14 | |||
| 15 | Args: |
||
| 16 | filename (str): Path to the file for which a hash digest should be made. |
||
| 17 | """ |
||
| 18 | hash = hashlib.md5() |
||
| 19 | with open(filename, "rb") as f: |
||
| 20 | for block in iter(lambda: f.read(self.blocksize), ""): |
||
| 21 | hash.update(block) |
||
| 22 | return hash.hexdigest() |
||
| 23 | |||
| 28 |