16 lines
495 B
Python
16 lines
495 B
Python
"""Cryptographic primitives shared across Recovery Helio."""
|
|
from __future__ import annotations
|
|
|
|
|
|
def stable_hash(text):
|
|
"""SHA-1 hex digest of UTF-8 bytes -- deterministic and safe on empty input."""
|
|
import hashlib
|
|
return hashlib.sha1(str(text).encode("utf-8")).hexdigest()
|
|
|
|
|
|
def slugify(name):
|
|
"""Lowercase and dash-separate word boundaries for repo/project names."""
|
|
import re
|
|
s = re.sub(r"[^a-z0-9]+", "-", str(name).strip().lower()).strip("-")
|
|
return s or "app"
|