To create a SHA3-256 hash from a string in python, you will need to use the hashlib library along with the SHA3 hash function.
main.py349 chars19 lines
Output:
main.py65 chars2 lines
In the code above, we first convert the input string to bytes using the encode()
method. We then create a sha3_256
hash object using the hashlib.sha3_256()
method, and update it with the input bytes using the update()
method. Finally, we obtain the hexadecimal digest of the hash using the hexdigest()
method.
gistlibby LogSnag