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



Rockbox mail archive

Subject: RE: clever algorithm string ->int id wanted

RE: clever algorithm string ->int id wanted

From: Stuart Tedford <stuart.tedford_at_piresearch.co.uk>
Date: Fri, 4 Oct 2002 08:42:53 +0100

Does the SH1 have a hardware crc module? If so you could use it to generate
the hash key on the string. I have used this in the past on a Misubishi M16
uController for a file system filename lookup function. But there is a
small chance that two totally different strings have the same key. I only
had a max of 1000 files in my filesystem and the file names only differed by
a few chars so it was perfect.

Stu.

> -----Original Message-----
> From: Daniel Stenberg [mailto:daniel_at_haxx.se]
> Sent: 04 October 2002 06:41
> To: Rockbox
> Subject: Re: clever algorithm string ->int id wanted
>
>
> 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/
>
Received on 2002-10-04

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy