Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 0B0ED2E0106 for ; Tue, 18 Mar 2008 16:36:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 75736-03 for ; Tue, 18 Mar 2008 16:36:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smaug.vex.net (smaug.vex.net [208.76.104.132]) by postgresql.org (Postfix) with ESMTP id BD3C42E0102 for ; Tue, 18 Mar 2008 16:36:20 -0300 (ADT) Received: from dilbert (dilbert.druid.net [207.35.13.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smaug.vex.net (Postfix) with ESMTP id CA0F117C97; Tue, 18 Mar 2008 15:36:18 -0400 (EDT) Date: Tue, 18 Mar 2008 15:36:13 -0400 From: "D'Arcy J.M. Cain" To: Steve Midgley Cc: lance@uiuc.edu, pgsql-sql@postgresql.org Subject: Re: Create on insert a unique random number Message-Id: <20080318153613.364cf08d.darcy@druid.net> In-Reply-To: <20080318192351.4AD972E0041@postgresql.org> References: <20080318190314.94E2A24A9A4@maia-3.hub.org> <20080318192351.4AD972E0041@postgresql.org> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.8; x86_64--netbsd) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/114 X-Sequence-Number: 30442 On Tue, 18 Mar 2008 12:23:35 -0700 Steve Midgley wrote: > 1) Create a second field (as someone recommend on this list) that is an > MD5 of your primary key. Use that as your "accessor" index from the web I strongly disagree for three reasons. First, if you are going to generate a key then don't store it. Just generate it every time. Second, don't generate it based on a known field. You may think that it is secure but what if you private key is compromised? Do you then change everyone's security code? Third, what if one person's code is compromised? If it is based on a calculation then you can't change that one person's security code. Generate a random number and store that. You will be much happier when something goes wrong and something always goes wrong. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.