123456789 |
- def get_hashes(file):
- md5 = hashlib.md5()
- sha256 = hashlib.sha256()
- with open(file, 'rb') as f:
- for chunk in iter(lambda: f.read(8192), b''):
- md5.update(chunk)
- sha256.update(chunk)
- hashes = {'md5': md5.hexdigest(), 'sha256': sha256.hexdigest(), }
- return hashes
|