-2
\$\begingroup\$

I am not sure what I am doing wrong as this code I am trying to make function which collects the md5 of all files within the selected folder and then prints it

path = filedialog.askdirectory()
SHA256_HASHES_pack1 = os.listdir(path)

for i in os.listdir(path):
    if os.path.isfile(i) in SHA256_HASHES_pack1:
        with open(i(), 'rb') as f:
            print(i)
            while True:
                data = f.read(BUF_SIZE)
                print(data)
            if not data:
                break
        md5.update(data)
        sha1.update(data)

print("MD5: {0}".format(md5.hexdigest()))
print("SHA1: {0}".format(sha1.hexdigest()))
\$\endgroup\$
0

0

Browse other questions tagged or ask your own question.