The problem reduces to finding two values A and B such that:
- A % MOD1 = B % MOD1
- A % MOD2 = B % MOD2
Any such pair constitutes a collision for the hash function. An appropriate testcase can then be generated as follows: 2
1 A
3 B
Choosing A and B is not that difficult. A very simple solution is A = 0 and B = any common multiple of MOD1 and MOD2. Any positive constant can be added to these values without losing the collision property.