1// hashes.h
2//
3// Copyright (c) 2003, Ingo Weinhold (bonefish@cs.tu-berlin.de)
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18//
19// You can alternatively use *this file* under the terms of the the MIT
20// license included in this package.
21
22#ifndef HASHES_H
23#define HASHES_H
24
25#include <SupportDefs.h>
26
27/*
28	\file hashes.h
29	\brief Hash functions.
30
31	key_offset_for_name() computes the maximal possible dir entry offset for
32	given name, i.e. the offset that has the maximal generation number.
33	Doing a rightmost close search for the respective key will produce
34	the rightmost entry with the same hash value as the supplied name
35	(if any). Walking backwards will find all other entries with that hash.
36*/
37
38typedef uint32 (*hash_function_t)(const signed char *, int);
39
40uint32 keyed_hash(const signed char *msg, int len);
41uint32 yura_hash(const signed char *msg, int len);
42uint32 r5_hash(const signed char *msg, int len);
43
44uint32 key_offset_for_name(hash_function_t hash, const char *name, int len);
45
46#endif	// HASHES_H
47