import hmac
import hashlib
import base64


def get_uid(secret_key, email):
    """
    This function calcualtes the unique user id
    :param secret_key: APP's secret key
    :param email: Github user's email
    :return: unique uid using HMAC
    """

    dig = hmac.new(bytes(secret_key.encode()), email.encode(), hashlib.sha256).digest()
    uid = base64.b64encode(dig).decode()
    return uid