File size: 4,840 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 |
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_
#ifdef DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_
#include "../uintn.h"
#include <utility>
namespace dlib
{
// ----------------------------------------------------------------------------------------
uint32 murmur_hash3 (
const void* key,
const int len,
const uint32 seed = 0
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
inline uint32 murmur_hash3_2 (
const uint32 v1,
const uint32 v2
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
inline uint32 murmur_hash3_3 (
const uint32 v1,
const uint32 v2,
const uint32 v3
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
std::pair<uint64,uint64> murmur_hash3_128bit (
const void* key,
const int len,
const uint64 seed = 0
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
std::pair<uint64,uint64> murmur_hash3_128bit (
const uint32& v1,
const uint32& v2,
const uint32& v3,
const uint32& v4
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
std::pair<uint64,uint64> murmur_hash3_128bit_3 (
uint64 k1,
uint64 k2,
uint64 k3
);
/*!
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/
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_MURMUR_HAsH_3_ABSTRACT_Hh_
|