summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/jhash.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/jhash.h')
-rw-r--r--apps/plugins/lib/jhash.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/plugins/lib/jhash.h b/apps/plugins/lib/jhash.h
new file mode 100644
index 0000000000..97d1ac3d93
--- /dev/null
+++ b/apps/plugins/lib/jhash.h
@@ -0,0 +1,67 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2009 by Andrew Mahone
11*
12* jhash.c headers
13*
14* This program is free software; you can redistribute it and/or
15* modify it under the terms of the GNU General Public License
16* as published by the Free Software Foundation; either version 2
17* of the License, or (at your option) any later version.
18*
19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20* KIND, either express or implied.
21*
22****************************************************************************/
23
24#ifndef _LIB_JHASH_H_
25#define _LIB_JHASH_H_
26#include <inttypes.h> /* defines uint32_t etc */
27#include <sys/types.h>
28#include <plugin.h>
29
30/*
31hashw() -- hash an array of uint32_t into a 32-bit value
32 k: pointer to the key, an array of uint32_t
33 length: number of elements in the key
34 initval: an initialization value
35 returns the 32-bit hash
36*/
37uint32_t hashw(const uint32_t *k, size_t length, uint32_t initval);
38
39/*
40hashw() -- hash an array of uint32_t into two 32-bit values
41(*pc) will be the same as the return value from hashword().
42 k: pointer to the key, an array of uint32_t
43 length: number of elements in the key
44 pc, pb: pointers to primary and secondary initial values, also used to store
45 the hash results.
46*/
47void hashw2 (const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb);
48
49/*
50hashs() -- hash an array of bytes into a 32-bit value
51 k: pointer to the key, an array of bytes
52 length: number of elements in the key
53 initval: an initialization value
54 returns the 32-bit hash
55*/
56uint32_t hashs( const void *key, size_t length, uint32_t initval);
57
58/*
59hashs2() -- hash an array of bytes into two 32-bit values
60 k: pointer to the key, an array of bytes
61 length: number of elements in the key
62 pc, pb: pointers to primary and secondary initial values, also used to store
63 the hash results.
64*/
65void hashs2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
66#endif
67