Re: Create on insert a unique random number - Mailing list pgsql-sql

From Vivek Khera
Subject Re: Create on insert a unique random number
Date
Msg-id 87444A52-4950-4A16-96FB-524BE22EF54C@khera.org
Whole thread Raw
In response to Re: Create on insert a unique random number  ("Campbell, Lance" <lance@uiuc.edu>)
List pgsql-sql
On Mar 18, 2008, at 2:40 PM, Campbell, Lance wrote:

> Why use a random number as a primary key?  Security via obscurity.
>
> I build web applications for a living.  In most of my applications  
> it is
> preferable to use a random primary key.  Why?

Don't expose the actual ID to the end user; only expose a reversible  
encrypted form of it.  We use a relatively simple hash + check  
character.   If you have several examples of it, you can reverse  
engineer it, but the casual "hacker" is easily thwarted.

You can use stronger encryption on the number when exposed to end  
users if you need.  You're making your DB overly complex.



pgsql-sql by date:

Previous
From: Erik Jones
Date:
Subject: Re: Create on insert a unique random number
Next
From: Steve Midgley
Date:
Subject: Re: Create on insert a unique random number