Hash signatures for files

82 Views Asked by At

I need to create a program that creates hash signatures for each file in my directory. I need the output to contain the filename and hash next to it.

This is the code I have so far and all it is doing is giving me the hashes.

import os, hashlib

path = "/home/ec2-user/environment"

for filename in os.listdir(path):
    if not os.path.isdir(filename):

        hasher = hashlib.md5()
    with open('39802.jpeg', 'rb') as afile:
        buf = afile.read()
    hasher.update(buf)
    print(hasher.hexdigest())
0

There are 0 best solutions below