I need to generate unique (random) numbers that I can trace back to a unique source number.
For example:
source number A can generate numbers A1, A1, A3 .... Am
source number B can generate numbers B1, B2, B3 .... Bm
...
source number N can generate numbers N1, N2, N3 .... Nm
All the source numbers A, B, .. N and generated numbers Ai, Bi, Ni should be unique and mutually exclusive.
Now for any generated number Ai, I should be able to compute unambiguously the source number A (and the same goes for Bi, Ci, ... Ni).
Can anybody help with the algorithm for this?
Use case: a user types a numeric code generated by this algorithm. The server should be able to identify this user, from the code alone. For others it should not be possible to identify the user, nor generate subsequent codes for that user.