Program to Find Hash of File | Python
Mar 04, 2021
Python,
813 Views
Program to Find Hash of File | Python
Program to Find Hash of File | Python
import hashlib
def hash_file(filename):
h = hashlib.sha1()
with open(filename,'rb') as file:
chunk = 0
while chunk != b'':
chunk = file.read(512)
h.update(chunk)
return h.hexdigest()
message = hash_file("track1.mp3")
print(message)