← Files Dispensa: lista de comprasARCHIVED FILE

src/mcp_despensa_hub/shared/codigo.py

326 Bytes · Nov 19, 2026 · 00:38 UTC

↓ Download file

See the change to this file →

"""Identificador público. Nunca o id numérico do banco."""

from __future__ import annotations

import hashlib

PREFIXO_LISTA = "LIS"
PREFIXO_COMPRA = "CMP"


def codigo_publico(prefixo: str, semente: str) -> str:
    digest = hashlib.sha256(semente.encode("utf-8")).hexdigest()[:6].upper()
    return f"{prefixo}-{digest}"

SHA-256: 0f580d8effd93e8a826e03dbc977ce22298d74a4cbe682d0036978d5ef328080