filepath = 'C://Users/Admin/Downloads/Snipaste_2020-10-29_14-22-44.png' file = open(filepath, "rb") md = hashlib.md5() md.update(file.read()) res1 = md.hexdigest() print(res1)