I recently wrote a script so that Python will open, read the file, hash the passwords in the file one by one and then save it to a separate file. But when I run the script, the hashlib module does not has the passwords one by one, but instead hashes the password name. Here is the script:
import hashlib
word_list = input("Input file name to pull words from: ")
hash_list = input("Input list to hash to: ")
h = hashlib.sha512()
f = open(word_list, 'r')
f.readline()
g = open(hash_list, 'w')
for word in word_list:
word = word.strip('\r\n')
h.update(word.encode())
hashed_word = h.hexdigest()
g.write(hashed_word)
I have tried different files with the same passwords in it, I have tried different named files with the same single password. When I run it with a different named file but the same password, it gives me a different hash. (Which I assume is the hash for the name of the file, because the hash is the same except for the end of it. Example filenames hash1 and hash2 have the same characters in the hash, but near the end they are different.