Skip to content

Hash

str_to_hash(text, hash_algorithm='sha256')

Source code in griptape/griptape/utils/hash.py
4
5
6
7
8
9
def str_to_hash(text: str, hash_algorithm: str = "sha256") -> str:
    m = hashlib.new(hash_algorithm)

    m.update(text.encode())

    return m.hexdigest()