Index: base/secure_hash.h |
diff --git a/base/secure_hash.h b/base/secure_hash.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..350b039a3438fdbaaa9c3780a0cdcbf44b0bdf13 |
--- /dev/null |
+++ b/base/secure_hash.h |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2006-2008 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. |
+ |
+#ifndef BASE_SECURE_HASH_H_ |
+#define BASE_SECURE_HASH_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/sha2.h" |
wtc
2011/01/25 19:06:43
This file should not need to include the header fo
bulach
2011/01/25 20:33:41
Done.
|
+ |
+namespace base { |
+ |
+// A wrapper for calculating secure hashes when the full string is not known in |
+// advance. |
wtc
2011/01/25 19:06:43
Remove "when the full string is not known in advan
bulach
2011/01/25 20:33:41
I rewrote the sentence, please let me know if it's
|
+class SecureHash { |
+ public: |
+ enum Type { |
wtc
2011/01/25 19:06:43
This enum should be named Algorithm. The constant
bulach
2011/01/25 20:33:41
Done.
|
+ TYPE_SHA256, |
+ }; |
+ virtual ~SecureHash() {} |
+ |
+ static SecureHash* Create(Type type); |
+ |
+ virtual void Update(const std::string& str) = 0; |
+ virtual void Finish(void* output, size_t len) = 0; |
+ |
+ protected: |
+ SecureHash() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(SecureHash); |
+}; |
+ |
+} // namespace base |
+ |
+#endif // BASE_SECURE_HASH_H_ |