Re: [GENERAL] [Q] string to int hash function for small range

2009-03-08 Thread V S P
Ok, thank you using \df *hash* from psql prompt I can see that is how I have to access this function select pg_catalog.hashtext('myusername') I will also play with other suggestions of get_byte of the MD5 result casted to a string. thanks again for all the replies, Vlad On Sat, 07 Mar

Re: [GENERAL] [Q] string to int hash function for small range

2009-03-07 Thread Scott Marlowe
On Sat, Mar 7, 2009 at 7:33 PM, V S P wrote: > 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

Re: [GENERAL] [Q] string to int hash function for small range

2009-03-07 Thread Martin Gainty
general@postgresql.org > Subject: Re: [GENERAL] [Q] string to int hash function for small range > > V S P wrote: > > 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 re

Re: [GENERAL] [Q] string to int hash function for small range

2009-03-07 Thread hubert depesz lubaczewski
On Sat, Mar 07, 2009 at 09:33:33PM -0500, V S P wrote: > 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 as

Re: [GENERAL] [Q] string to int hash function for small range

2009-03-07 Thread John R Pierce
V S P wrote: 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 integ

[GENERAL] [Q] string to int hash function for small range

2009-03-07 Thread V S P
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