1
I’m having a problem with the arguments I pass in the function below, I’m trying to pass the argument sha512 for hash_type, so that the code within the function is replaced, and so hash_target would be passed by the correct hash algorithm, but whenever I run the code, python returns an error message saying that the library hashlib has no function hash_type, which shows that the substitution is not happening, which can be done to fix this problem ?
Code:
import sys
import hashlib
def main(hash_type,wordlist='palavrasptbr'):
hash_target = input("Hash :\n")
hash_target = bytes(hash_target.encode('utf-8'))
wordlist += '.txt'
archive = open(wordlist, 'r')
print(archive)
hash_target = bytes(hash_target)
print(hashing_sha512(bytes(hash_target)))
def hashing_sha512(hash_target):
hashing = hashlib.sha512()
hashing.update(hash_target)
return hashing.hexdigest()
if __name__ == "__main__":
try:
main(sys.argv[1], sys.argv[2])
except KeyboardInterrupt:
pass
put the full code bless
– user45474