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

Re: [HACKERS] Patch for UUID datatype (beta)

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Jim C(dot) Nasby" <jimn(at)enterprisedb(dot)com>
Cc: Gevik Babakhani <pgdev(at)xs4all(dot)nl>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,pgsql-hackers(at)postgresql(dot)org,Andreas Pflug <pgadmin(at)pse-consulting(dot)de>,pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Patch for UUID datatype (beta)
Date: 2006-09-18 21:13:27
Message-ID: 20060918211327.GJ8796@svana.org (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Mon, Sep 18, 2006 at 04:00:22PM -0500, Jim C. Nasby wrote:
> BTW, at a former company we used SHA1s to identify files that had been
> uploaded. We were wondering on the odds of 2 different files hashing to
> the same value and found some statistical comparisons of probabilities.
> I don't recall the details, but the odds of duplicating a SHA1 (1 in
> 2^160) are so insanely small that it's hard to find anything in the
> physical world that compares. To duplicate random 256^256 numbers you'd
> probably have to search until the heat-death of the universe.

The birthday paradox gives you about 2^80 (about 10^24) files before a
SHA1 match, which is huge enough as it is. AIUI a UUID is only 2^128
bits so that would make 2^64 (about 10^19) random strings before you
get a duplicate. Embed the time in there and the chance becomes
*really* small, because then you have to get it in the same second.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2006-09-18 21:17:50
Subject: Re: [HACKERS] Patch for UUID datatype (beta)
Previous:From: Tom DunstanDate: 2006-09-18 21:09:52
Subject: Re: OID conflicts

pgsql-patches by date

Next:From: Jim C. NasbyDate: 2006-09-18 21:17:50
Subject: Re: [HACKERS] Patch for UUID datatype (beta)
Previous:From: Jim C. NasbyDate: 2006-09-18 21:00:22
Subject: Re: [HACKERS] Patch for UUID datatype (beta)

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