1 // Copyright (c) 2012 The Chromium 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.
5 // Interface to SHA1 digest computation.
7 #ifndef GOOGLE_CACHEINVALIDATION_DEPS_SHA1_DIGEST_FUNCTION_H_
8 #define GOOGLE_CACHEINVALIDATION_DEPS_SHA1_DIGEST_FUNCTION_H_
12 #include "base/sha1.h"
13 #include "google/cacheinvalidation/deps/digest-function.h"
14 #include "google/cacheinvalidation/deps/stl-namespace.h"
16 namespace invalidation {
18 using ::INVALIDATION_STL_NAMESPACE::string;
20 class Sha1DigestFunction : public DigestFunction {
22 Sha1DigestFunction() : reset_needed_(false) {}
24 virtual void Reset() {
25 reset_needed_ = false;
29 virtual void Update(const string& s) {
30 CHECK(!reset_needed_);
34 virtual string GetDigest() {
35 CHECK(!reset_needed_);
37 return base::SHA1HashString(buffer_);
45 } // namespace invalidation
47 #endif // GOOGLE_CACHEINVALIDATION_DEPS_SHA1_DIGEST_FUNCTION_H_