uuid types 3 and 5

Martin Baxter mblivecode at harbourhosting.co.uk
Thu Jan 9 18:22:50 EST 2014


On 09/01/14 22:53, Monte Goulding wrote:
> 
> On 10/01/2014, at 9:22 AM, Martin Baxter wrote:
> 
>> So I take it that the situations where you would use this type of
>> uuid are really similar to those situations where you might use a
>> hash, but where a simple hash wouldn't povide a high enough
>> probability of uniqueness for the context.
> 
> Actually a sha1 hash is more likely to be unique than a uuid. I
> really don't see the advantage of using type 3 or 5 uuid rather than
> sha1 as in: local tSHA get binaryDecode("h*",sha1Digest("hello"),
> tSHA) answer tSHA
> 
> Other than saving a few bits because the uuid is shorter... and
> perhaps that you can do things like upgrade from md5 based to sha
> based without messing with your database. Type 3 and 5 uuids are
> basically most bits form the hash and some other bits to identify the
> type.
> 
> I suspect git would be the most heavily used distributed database in
> use and it's built on the sha 1 hash. Even in the biggest git repo
> (the linux kernel) they only need to use the first 12 chars of the
> sha to uniquely identify the object in the database.
> 
> Cheers
> 

Interesting.

Because more bits = more entropy, presumably.

Martin




More information about the use-livecode mailing list