"""Definition of hash_password function.""" import bcrypt def hash_password(password: str) -> str: """Hash a password using bcrypt. Args: password: Plain text password to hash Returns: Hashed password as a string """ salt = bcrypt.gensalt() hashed: bytes = bcrypt.hashpw(password.encode("utf-8"), salt) return hashed.decode("utf-8")