Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: clever algorithm string ->int id wanted
From: Daniel Stenberg (daniel_at_haxx.se)
Date: 2002-10-04


On Thu, 3 Oct 2002 phil_at_x-phobie.de wrote:

> I need an algorithm to calculate a unique id from a string, just similar to
> calculating a hash key.

Since the strings are all known at the time you want to calculate the hashes,
you can generate a "perfect hash":

        http://www.google.com/search?q=perfect+hash

A tool that makes this easier, is gperf:

        http://www.gnu.org/software/gperf/gperf.html

-- 
Daniel "Bagder" Stenberg -- http://rockbox.haxx.se/



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa