blob: 45176536b1581b7678993c6911c24255bd440c0f [file] [log] [blame]
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include <string>
#include "base/basictypes.h"
#include "net/base/net_api.h"
namespace disk_cache {
// From
// This is the hash used on WebCore/platform/stringhash
NET_TEST uint32 SuperFastHash(const char * data, int len);
inline uint32 Hash(const char* key, size_t length) {
return SuperFastHash(key, static_cast<int>(length));
inline uint32 Hash(const std::string& key) {
if (key.empty())
return 0;
return SuperFastHash(, static_cast<int>(key.size()));
} // namespace disk_cache