Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2161)

Unified Diff: base/secure_hash.h

Issue 6276002: Abstracts SHA256 context for NSS / OpenSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moves to SecureHash (and other comments) Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « base/base.gypi ('k') | base/secure_hash_nss.cc » ('j') | base/secure_hash_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698