ReMe/reme_cli/utils/common_utils.py
jinli.yl 92ab1d23c6
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
init
2026-04-09 17:56:02 +08:00

14 lines
361 B
Python

import hashlib
def hash_text(text: str, encoding: str = "utf-8") -> str:
"""Generate SHA-256 hash of text content.
Args:
text: Input text to hash
encoding: Encoding of the text (default: "utf-8")
Returns:
Hexadecimal representation of the SHA-256 hash
"""
return hashlib.sha256(text.encode(encoding)).hexdigest()