Ensure `ip` parameter is explicitly cast to string before creating a SHA-256 hash to prevent runtime errors.