import hashlib
import base64


def get_credential_from_wifi_password(wifi_password: str) -> str:
    """Calculate MQTT credential from WiFi password."""
    hash_ = hashlib.sha512()
    hash_.update(wifi_password.encode("utf-8"))
    return base64.b64encode(hash_.digest()).decode("utf-8")