E
E
Eugene2015-02-21 22:25:23
Encryption
Eugene, 2015-02-21 22:25:23

How to hide post id as another number up to 16 characters long?

There is a table with a pledged capacity of 1 billion records. You need to come up with a public identifier that will not be incremental, will consist of numbers and the length of which will be a maximum of 16 characters. Is there such an encryption/conversion algorithm? Should I use random?
It is possible that there is such an encryption that will output a hash of 16 characters long from the HEX set, which in DEC is 19 characters long, which is also acceptable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-02-21
@egetmanenko

Hashing will lead to the fact that there will be cases when different SrcIDs will turn into the same PubIDs, which, as I understand it, is unacceptable for you.
What you need is plain symmetric encryption. It is by definition bijective, i.e. maps each SrcID to a unique PubID (so that the text can be unambiguously decoded back). If you are comfortable with the 16 character space of the HEX set, then any block cipher with a block size of 64 bits will do - I would suggest RC5 or Blowfish. Set the encryption key randomly from a stable source (for example, manually) and most importantly - do not change during the entire lifetime of the system - then PubIDs will be guaranteed to be unique as SrcID increases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question