Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] SHA1 on postgres 8.3

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] SHA1 on postgres 8.3
Date: 2008-04-03 15:32:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
Greg Sabino Mullane wrote:
> 4) We're also encouraging the use of md5() by making it the only option.
> Yes, we can talk about why people *shouldn't* use it for this purpose
> or that, but they will.

There is always the Java route - internal classes have package-scope 
constructors to specifically prevent them from being accidentally used 
(and relied on).

I prefer the "let them use it, but warn them not to have expectations" 
route, which is what PostgreSQL is doing today. The above is not a 
legitimate reason to provide additional functions in the core.

> 5) It seems unwise to go through the trouble of just adding sha1(), when
> we could easily add some better hashes, which has the nice side effect
> of making us stand out more and push the envelope, rather than play follow
> the leader, as was mentioned at PGCon East

This presumes that better hashes truly exist. It is basic math to show 
that all hashes will include collisions. Ignoring the possibility that 
one hash has theoretical better distribution for real documents, the 
real "benefit" of SHA-1 over MD5, is that it has more bits. The 
"ultimate" solution here, is to store the original using the "full copy" 
hash technique, with 0 chance of collision. This extreme defeats the 
purpose of a hash to start with.

Why does PostgreSQL need something better than md5 as part of core? 
Bragging rights?


Mark Mielke <mark(at)mielke(dot)cc>

In response to


pgsql-hackers by date

Next:From: Tom DunstanDate: 2008-04-03 15:33:05
Subject: Re: modules
Previous:From: PFCDate: 2008-04-03 15:22:28
Subject: Re: COPY Transform support

pgsql-general by date

Next:From: Ivan Sergio BorgonovoDate: 2008-04-03 15:32:54
Subject: Re: is it helpful for the optimiser/planner to add LIMIT 1
Previous:From: Andrew DunstanDate: 2008-04-03 14:55:39
Subject: Re: modules

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group