mal_s3_upload_2.py 312 B

123456789
  1. def get_hashes(file):
  2. md5 = hashlib.md5()
  3. sha256 = hashlib.sha256()
  4. with open(file, 'rb') as f:
  5. for chunk in iter(lambda: f.read(8192), b''):
  6. md5.update(chunk)
  7. sha256.update(chunk)
  8. hashes = {'md5': md5.hexdigest(), 'sha256': sha256.hexdigest(), }
  9. return hashes