1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
6 #include "util/coding.h"
11 uint32_t Hash(const char* data, size_t n, uint32_t seed) {
12 // Similar to murmur hash
13 const uint32_t m = 0xc6a4a793;
14 const uint32_t r = 24;
15 const char* limit = data + n;
16 uint32_t h = seed ^ (n * m);
18 // Pick up four bytes at a time
19 while (data + 4 <= limit) {
20 uint32_t w = DecodeFixed32(data);
27 // Pick up remaining bytes
28 switch (limit - data) {
45 } // namespace leveldb