Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d01eee95
Commit
d01eee95
authored
Nov 27, 2012
by
Davis King
Browse files
Added murmur_hash3_3()
parent
49f2d6f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
dlib/general_hash/murmur_hash3.h
dlib/general_hash/murmur_hash3.h
+47
-0
dlib/general_hash/murmur_hash3_abstract.h
dlib/general_hash/murmur_hash3_abstract.h
+16
-0
No files found.
dlib/general_hash/murmur_hash3.h
View file @
d01eee95
...
...
@@ -255,6 +255,53 @@ namespace dlib
return
h1
;
}
// ----------------------------------------------------------------------------------------
inline
uint32
murmur_hash3_3
(
const
uint32
v1
,
const
uint32
v2
,
const
uint32
v3
)
{
uint32
h1
=
v3
;
uint32
c1
=
0xcc9e2d51
;
uint32
c2
=
0x1b873593
;
//----------
// body
uint32
k1
=
v1
;
k1
*=
c1
;
k1
=
DLIB_ROTL32
(
k1
,
15
);
k1
*=
c2
;
h1
^=
k1
;
h1
=
DLIB_ROTL32
(
h1
,
13
);
h1
=
h1
*
5
+
0xe6546b64
;
k1
=
v2
;
k1
*=
c1
;
k1
=
DLIB_ROTL32
(
k1
,
15
);
k1
*=
c2
;
h1
^=
k1
;
h1
=
DLIB_ROTL32
(
h1
,
13
);
h1
=
h1
*
5
+
0xe6546b64
;
//----------
// finalization
h1
^=
8
;
// =^ by length in bytes
h1
=
murmur_fmix
(
h1
);
return
h1
;
}
// ----------------------------------------------------------------------------------------
inline
std
::
pair
<
uint64
,
uint64
>
murmur_hash3_128bit
(
...
...
dlib/general_hash/murmur_hash3_abstract.h
View file @
d01eee95
...
...
@@ -44,6 +44,22 @@ namespace dlib
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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment