@staticmethod
def hash(request, algorithm='md5', digest='hex'):
    h = hashlib.new(algorithm, request)
    if (digest == 'hex'):
        return h.hexdigest()
    elif (digest == 'base64'):
        return base64.b64encode(h.digest())
    return h.digest()
@staticmethod
def hash(request, algorithm='md5', digest='hex'):
    h = hashlib.new(algorithm, request)
    if (digest == 'hex'):
        return h.hexdigest()
    elif (digest == 'base64'):
        return base64.b64encode(h.digest())
    return h.digest()