We are using MySQL and developing an application where we\'d like the ID sequence not to be publicly visible... the IDs are hardly top secret and there is no significant iss
You could simply XOR with 0xDEADBEEF, if that's good enough.
Alternatively multiply by an odd number mod 2^32. For the inverse mapping just multiply by the multiplicative inverse
Example: n = 2345678901; multiplicative inverse (mod 2^32): 2313902621 For the mapping just multiply by 2345678901 (mod 2^32):
1 --> 2345678901 2 --> 396390506
For the inverse mapping, multiply by 2313902621.