[Q] string to int hash function for small range

Поиск
Список
Период
Сортировка
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 по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Enable user access from remote host
Следующее
От: John R Pierce
Дата:
Сообщение: Re: [Q] string to int hash function for small range