File size: 7,632 Bytes
9375c9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - murmur_hash3_abstract.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2011  Davis E. King ([email protected])
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#undef</font> DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_ 
<font color='#0000FF'>#ifdef</font> DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_ 

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../uintn.h.html'>../uintn.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>utility<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    uint32 <b><a name='murmur_hash3'></a>murmur_hash3</b> <font face='Lucida Console'>(</font> 
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font><font color='#5555FF'>*</font> key, 
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> len, 
        <font color='#0000FF'>const</font> uint32 seed <font color='#5555FF'>=</font> <font color='#979000'>0</font>
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        requires
            - key == a pointer to a block of memory len bytes long
        ensures
            - returns a 32bit hash of the len bytes pointed to by key.  
            - Each value of seed results in a different hash function being used.  
              (e.g. murmur_hash3(key,len,0) should generally not be equal to murmur_hash3(key,len,1))
            - This function is machine architecture agnostic and should always give the same
              hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x86_32.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>inline</font> uint32 <b><a name='murmur_hash3_2'></a>murmur_hash3_2</b> <font face='Lucida Console'>(</font> 
        <font color='#0000FF'>const</font> uint32 v1,
        <font color='#0000FF'>const</font> uint32 v2 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - returns a 32bit hash of the two integers given to this function.  
            - This function is machine architecture agnostic and should always give the same
              hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x86_32.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>inline</font> uint32 <b><a name='murmur_hash3_3'></a>murmur_hash3_3</b> <font face='Lucida Console'>(</font> 
        <font color='#0000FF'>const</font> uint32 v1,
        <font color='#0000FF'>const</font> uint32 v2,
        <font color='#0000FF'>const</font> uint32 v3 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - returns a 32bit hash of the three integers given to this function.  
            - This function is machine architecture agnostic and should always give the same
              hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x86_32.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::pair<font color='#5555FF'>&lt;</font>uint64,uint64<font color='#5555FF'>&gt;</font> <b><a name='murmur_hash3_128bit'></a>murmur_hash3_128bit</b> <font face='Lucida Console'>(</font> 
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font><font color='#5555FF'>*</font> key, 
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> len,
        <font color='#0000FF'>const</font> uint64 seed <font color='#5555FF'>=</font> <font color='#979000'>0</font>
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        requires
            - key == a pointer to a block of memory len bytes long
        ensures
            - returns a 128bit hash (as two 64bit numbers) of the len bytes pointed to by key.  
            - Each value of seed results in a different hash function being used.  
              (e.g. murmur_hash3_128bit(key,len,0) should generally not be equal to 
              murmur_hash3_128bit(key,len,1))
            - This function is machine architecture agnostic and should always give the same
              hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x64_128.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::pair<font color='#5555FF'>&lt;</font>uint64,uint64<font color='#5555FF'>&gt;</font> <b><a name='murmur_hash3_128bit'></a>murmur_hash3_128bit</b> <font face='Lucida Console'>(</font> 
        <font color='#0000FF'>const</font> uint32<font color='#5555FF'>&amp;</font> v1, 
        <font color='#0000FF'>const</font> uint32<font color='#5555FF'>&amp;</font> v2, 
        <font color='#0000FF'>const</font> uint32<font color='#5555FF'>&amp;</font> v3, 
        <font color='#0000FF'>const</font> uint32<font color='#5555FF'>&amp;</font> v4 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - returns a 128bit hash (as two 64bit numbers) of the 4 integers given to this
              function. 
            - This function is machine architecture agnostic and should always give the
              same hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x64_128.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::pair<font color='#5555FF'>&lt;</font>uint64,uint64<font color='#5555FF'>&gt;</font> <b><a name='murmur_hash3_128bit_3'></a>murmur_hash3_128bit_3</b> <font face='Lucida Console'>(</font> 
        uint64 k1, 
        uint64 k2,
        uint64 k3 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - returns a 128bit hash (as two 64bit numbers) of the 3 integers given to this
              function. 
            - This function is machine architecture agnostic and should always give the
              same hash value when presented with the same inputs.
            - This hashing algorithm is Austin Appleby's excellent MurmurHash3_x64_128.  
              See: http://code.google.com/p/smhasher/
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_
</font>


</pre></body></html>