I have a problem with the arguments that I pass in the function below, I am trying to pass the sha512 argument to hash_type , so that in the code within the function the substitution, and so the hash_target would be passed by the correct hash algorithm, however whenever I run the code, python returns an error message saying that the hashlib library has no function hash_type , which shows that the replacement is not happening, what 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