I have a function which takes an integer from within a range (for example, 0-9999 with a range of 10,000) which outputs another integer within the same range. To my understanding, this is a perfect hash function. Each input within the range maps to another integer within the range without collisions.
prime = 479 range = 10000 shuffle(input, prime, range) = (input * prime) % range
An input of 123
with a prime of 479
in a range of 10000
will return 8917
.
Is this function reversible? Given the output, the range and the prime, can I determine the original input (123
)?