One-to-one integer mapping function

前端 未结 5 1103
囚心锁ツ
囚心锁ツ 2020-12-16 00:27

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

5条回答
  •  天命终不由人
    2020-12-16 00:44

    You can use mod operation for big prime number.

    your number * big prime number 1 / big prime number 2.

    Prime number 1 should be bigger than second. Seconds should be close to 2^32 but less than it. Than it will be hard to substitute.

    Prime 1 and Prime 2 should be constants.

提交回复
热议问题