Convert string into SHA-256 hash key for encryption in python
To generate a SHA-256 hash key, you can use a variety of programming languages and libraries. Here is an example of how to generate a SHA-256 hash in Python:
import hashlib
# String to be hashed
data = "example"
# Create SHA-256 hash object
hash_object = hashlib.sha256()
# Update the hash object with bytes of the string
hash_object.update(data.encode())
# Get the hexadecimal representation of the hash
hash_hex = hash_object.hexdigest()
print(hash_hex)
This will output a 64-character hexadecimal string, which is the SHA-256 hash of the input data.