def hmac_msg()

in src/ppxgboost/PPBooster.py [0:0]


def hmac_msg(prf_key_hash, feature):
    """
    Using hmac to produce the pseudonyms for the feature vector.
    :param prf_key_hash: hash key as bytes
    :param feature: feature name as a string (encoded using 'UTF-8')
    :return: hmac value
    """
    message = bytes(feature, encodings.utf_8.getregentry().name)
    sig = base64.b64encode(hmac.new(prf_key_hash, message, hashlib.sha256).digest())
    return sig.decode()