I\'m looking for a way to encrypt/obfuscate an integer ID into another integer. More precisely, I need a function int F(int x)
, so that
I wrote an article on secure permutations with block ciphers, which ought to fulfil your requirements as stated.
I'd suggest, though, that if you want hard to guess identifiers, you should just use them in the first place: generate UUIDs, and use those as the primary key for your records in the first place - there's no need to be able to convert to and from a 'real' ID.