0
I have a problem to use the python hashlib, because I am comparing the hashs generated with the line below, with the hashs generated on the site : 'http://temp.crypo.com/sha512.htm', but when comparing the results I see that they are different.
Code used to generate hashs:
def encoding(hash_test):
return hashlib.sha512(bytes(hash_test, encoding='UTF-16LE')).hexdigest()
Note: I based on the python documentation code(https://docs.python.org/3/library/hashlib.html) to mount this.
Hash generated by code:
3a94b49c382f9c39a83e0ae31a26bdcf23f74b6c81eb8779f1305b840aaabc94e3921d6f9d0e25b15f6569c42dc24f9524540b765147699e33d903dc6a85a354
Hash generated by the site:
b123e9e19d217169b981a61188920f9d28638709a5132201684d792b9264271b7f09157ed4321b1c097f7a4abecfc0977d40a7ee599c845883bd1074ca23c4af
Note: I used in both site and code the word 'test' (no áspas) to generate the hashes.
What’s wrong with the code so the results are different ?
When using this code python returns a 'Typeerror', and says that Unicode-objects must be encoded before passing through the hash algorithm. Note: in python there is no need for ';', at the end of the lines.
– user62320
@Gabriel: Response edited.
– Lacobus