from typing import Optional
from typing import Tuple
import crypt


def get_password_hash(password: str, salt: Optional[str] = None) -> Tuple[str, str]:
    """Get user password hash."""
    salt = salt or crypt.mksalt(crypt.METHOD_SHA256)
    return salt, crypt.crypt(password, salt)