Return the md5 hash of a big file
(FilePath)
| 342 | PrintAndLog(Hash + u' '+ LOCAL_HASHES_DB[Hash], 'WARNING') |
| 343 | |
| 344 | def BigFileMd5(FilePath): |
| 345 | ''' Return the md5 hash of a big file ''' |
| 346 | |
| 347 | Md5 = hashlib.md5() |
| 348 | try: |
| 349 | with open(FilePath, 'rb') as f: |
| 350 | for Chunk in iter(partial(f.read, 1048576), ''): |
| 351 | Md5.update(Chunk) |
| 352 | return Md5.hexdigest() |
| 353 | except: |
| 354 | PrintAndLog(u'Cannot hash ' + FilePath.decode('utf-8'), 'ERROR') |
| 355 | return False |
| 356 | |
| 357 | def UniversalReadPlist(PlistPath): |
| 358 | ''' Try to read a plist depending of the plateform and the available libs. Good luck Jim... ''' |
no test coverage detected