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

Unified Diff: base/md5.h

Issue 7466003: MD5Update function uses StringPiece instead of raw buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove line from license. Created 9 years, 5 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
« no previous file with comments | « no previous file | base/md5.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/md5.h
diff --git a/base/md5.h b/base/md5.h
index a31732995668acb5ff5c363dafe125378326dfcf..5a1762b0a172fc99c502a1b39c9f65d58021459c 100644
--- a/base/md5.h
+++ b/base/md5.h
@@ -6,9 +6,8 @@
#define BASE_MD5_H_
#pragma once
-#include <string>
-
#include "base/base_api.h"
+#include "base/string_piece.h"
namespace base {
@@ -52,10 +51,10 @@ BASE_API void MD5Sum(const void* data, size_t length, MD5Digest* digest);
// MD5Update().
BASE_API void MD5Init(MD5Context* context);
-// For the given buffer of data, updates the given MD5 context with the sum of
-// the data. You can call this any number of times during the computation,
-// except that MD5Init() must have been called first.
-BASE_API void MD5Update(MD5Context* context, const void* data, size_t length);
+// For the given buffer of |data| as a StringPiece, updates the given MD5
+// context with the sum of the data. You can call this any number of times
+// during the computation, except that MD5Init() must have been called first.
+BASE_API void MD5Update(MD5Context* context, const StringPiece& data);
// Finalizes the MD5 operation and fills the buffer with the digest.
BASE_API void MD5Final(MD5Digest* digest, MD5Context* context);
@@ -64,7 +63,7 @@ BASE_API void MD5Final(MD5Digest* digest, MD5Context* context);
BASE_API std::string MD5DigestToBase16(const MD5Digest& digest);
// Returns the MD5 (in hexadecimal) of a string.
-BASE_API std::string MD5String(const std::string& str);
+BASE_API std::string MD5String(const StringPiece& str);
} // namespace base
« no previous file with comments | « no previous file | base/md5.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698