Let say I have a table Orders
with auto-incremented id, e.g. 1, 2, 3, 4..., and they are current queried as http://www.example.com/order?id={1,2,3..}
Now, I want to hash primary key [1, 2, 3, ..] into another number called Order Number so our customer can reference them in their request, e.g.
1 -> 100192938303
2 -> 293029200002
I want the following:
- Not able to guess how many order I've created everyday by looking at the auto increment ID
- No DB extra lookup is neeed, purely hash by PHP (and a pre-defined salt)
- No collision
Is it possible?
I think you can probably choose easier approach - do not use auto incrementing id, use random integers as ids. Example:
This way you: