[Q] string to int hash function for small range - Mailing list pgsql-general

From V S P
Subject [Q] string to int hash function for small range
Date
Msg-id 1236479613.5431.1304211299@webmail.messagingengine.com
Whole thread Raw
Responses Re: [Q] string to int hash function for small range  (John R Pierce <pierce@hogranch.com>)
Re: [Q] string to int hash function for small range  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: [Q] string to int hash function for small range  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
I would like to have a function
given a user id varchar(64) to get a hash number between 0 and 255.

I first tried md5 but the number it returns is very big and cannot
be converted to an INT

there is likely a way to simply add ascii values of the userId together
to get a small integer, but wanted to know if there are any other
'built-in' ways

this is to get the database id based on user id.

thanks in advance,
Vlad
--
  V S P
  toreason@fastmail.fm

--
http://www.fastmail.fm - One of many happy users:
  http://www.fastmail.fm/docs/quotes.html


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Enable user access from remote host
Next
From: John R Pierce
Date:
Subject: Re: [Q] string to int hash function for small range