Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hasher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
20 
21 #ifndef PAGESPEED_KERNEL_BASE_HASHER_H_
22 #define PAGESPEED_KERNEL_BASE_HASHER_H_
23 
27 
28 namespace net_instaweb {
29 
30 class Hasher {
31  public:
34  explicit Hasher(int max_chars);
35  virtual ~Hasher();
36 
42  GoogleString Hash(const StringPiece& content) const;
43 
49  int HashSizeInChars() const;
50 
52  uint64 HashToUint64(const StringPiece& content) const;
53 
57  virtual GoogleString RawHash(const StringPiece& content) const = 0;
58 
60  virtual int RawHashSizeInBytes() const = 0;
61 
62  private:
63  int max_chars_;
64 
65 
66 };
67 
68 }
69 
70 #endif
GoogleString Hash(const StringPiece &content) const
virtual GoogleString RawHash(const StringPiece &content) const =0
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
int HashSizeInChars() const
uint64 HashToUint64(const StringPiece &content) const
Uses first 64-bits of hash to make a uint64 version of hash.
Hasher(int max_chars)
Definition: hasher.h:30
virtual int RawHashSizeInBytes() const =0
The number of bytes RawHash will produce.