hash
Adapted from the Griptape AI Framework documentation.
Source Code in griptape/utils/hash.py
def bytes_to_hash(data: bytes, hash_algorithm: str = "sha256") -> str: m = hashlib.new(hash_algorithm) m.update(data) return m.hexdigest()
str_to_hash(text, hash_algorithm='sha256')
Source Code in griptape/utils/hash.py
def str_to_hash(text: str, hash_algorithm: str = "sha256") -> str: m = hashlib.new(hash_algorithm) m.update(text.encode()) return m.hexdigest()
- On this page
- str_to_hash(text, hash_algorithm='sha256')
Could this page be better? Report a problem or suggest an addition!