def get_hash(x, a, b, p, m):
    """
    a must be in [1, (p-1)]
    b must be in [1, (p-1)]
    p is a prime number that is greater than max possible value of x
    h(x, a, b) = ((ax + b) mod p)mod m
    m is a max possible value you want for hash code + 1
    """
    if a >= p or b >= p:
        print('error in input params of hash function')
        return None
    return ((a * x + b) % p) % m