views:

19

answers:

1

Does anybody know how gmail goes from the id of an email in their database to a String URL? I dont really like the idea of putting the actual database id into the URL as this would tell people how many rows of data our in the database and other information.

Is there a way of mapping from a database id to an alphanumeric String which is bi-directional and doesnt give away any information about the database id?

Thxs.

A: 

Who says Gmail is using a numeric ID in their database? They could very easily be using string IDs and the URLs would then map directly. You could do that, or keep your numeric ID but also have a separate column with a randomly-generated string. Index that with a unique key, and use that in your URLs.

Or, if you just don't want people to be able to see the number of rows, you could probably encrypt the ID with some simple encryption algorithm and then base64 that so it just looks like a random code.

Daniel15