mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-06-11 01:45:58 +00:00
Fix safe user id digest algorithm
This commit is contained in:
@@ -47,7 +47,7 @@ def make_safe_user_id(raw: str) -> str:
|
|||||||
sanitized = _UNSAFE_USER_ID_CHAR_RE.sub("-", raw)
|
sanitized = _UNSAFE_USER_ID_CHAR_RE.sub("-", raw)
|
||||||
if sanitized == raw:
|
if sanitized == raw:
|
||||||
return raw
|
return raw
|
||||||
digest = hashlib.sha1(raw.encode("utf-8")).hexdigest()[:_SAFE_USER_ID_DIGEST_HEX_LEN]
|
digest = hashlib.sha256(raw.encode("utf-8")).hexdigest()[:_SAFE_USER_ID_DIGEST_HEX_LEN]
|
||||||
return f"{sanitized}-{digest}"
|
return f"{sanitized}-{digest}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user