def hash_values(values, alg='md5'):
    """Hash a list of values."""
    import hashlib
    if alg not in ['md5', 'sha1', 'sha256']:
        raise Exception('Invalid hashing algorithm!')
    hasher = getattr(hashlib, alg)
    if type(values) == str:
        output = hasher(values).hexdigest()
    elif type(values) == list:
        output = list()
        for item in values:
            output.append(hasher(item).hexdigest())
    return output
