0
I would like to generate a hash with SHA256 of a set of files. For this I compressed all in format .zip
and I am using the following code(Python):
from hashlib import sha256
myFile = 'path/to/my/file.zip'
with open(myFile,'rb') as f:
for line in f:
hashedWord = sha256(line.rstrip()).hexdigest()
print(hashedWord)
I was wondering if this code is encoding all the lines of all my files on .zip
or if the method is incorrect
You want to generate the hash separately for each file?
– Woss
Hi @Andersoncarloswoss, want a unique hash for all files contained in zip
– Lucas Torres
Then you could explain why you went through the file lines?
– Woss
@Andersoncarloswoss using only hashedWord = sha256(f). hexdigest() the code returns error(Typeerror: Object supporting the buffer API require). So I went through all the lines as I figured that if the zip file is a set of lines that will represent the content, the method of going through the lines would also be correct. That is the doubt
– Lucas Torres