mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-19 00:01:33 +00:00
14 lines
361 B
Python
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()
|