def order(generator: int, modulus: int) -> int:
    """
    Calculates the order of a generator in the cyclic group Z_n^*.
    """
    for exponent in range(1, modulus):
        if pow(generator, exponent) % modulus == 1:
            return exponent

    return -1