Re: hash options

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: hash options
Date: 2012-01-22 16:10:53
Message-ID: CAPTjJmpSZMux+i5AuLheyJ0d_7po+__2EpHAv6XBTvE5P=DChQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 23, 2012 at 2:59 AM, Little, Douglas
<DOUGLAS(dot)LITTLE(at)orbitz(dot)com> wrote:
>
> I’ve implemented with MD5.  It works fine,  the problem I have is the size of the md5 (32 bytes) is often longer than the original string – thus not accomplishing what I want – space savings.

You can always use a truncated hash - for instance, take the first 6-8
hex digits of the MD5 or SHA1 hash. For human readability, that's
likely to be all you need (for instance, git references commits by
their SHA1 hashes, but you can work with just the first six digits
quite happily). Otherwise, can you provide more details on why you
need a hash, and why it wants to be shorter than the original?

Chris Angelico

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-01-22 17:06:20 Re: Database takes up MUCH more disk space than it should
Previous Message Little, Douglas 2012-01-22 15:59:55 hash options