Python sha256 sample code
#!/usr/bin/env python3
import hashlib
def encode(text: str) -> str:
"""
计算输入字符串的 SHA-256 哈希值
Args:
text: 输入字符串
Returns:
str: 十六进制格式的哈希值
"""
return hashlib.sha256(text.encode('utf-8')).hexdigest()
if __name__ == "__main__":
input_text = "1234567"
encoded = encode(input_text)
print(f"Encoded: {encoded}")