import hashlib
import secrets
import string

BASE62 = string.ascii_letters + string.digits


def compute_sha256(data: bytes) -> str:
    return hashlib.sha256(data).hexdigest()


def generate_short_id(length: int = 8) -> str:
    return "".join(secrets.choice(BASE62) for _ in range(length))
