diff options
author | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 23:39:50 +0000 |
---|---|---|
committer | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 23:39:50 +0000 |
commit | a3bcff633580fa9afd4653817f497d8a49235994 (patch) | |
tree | d81bbfab47ed019ea0eb47ccdfb914944f7bafdf /base/md5.h | |
parent | d045e3746c58aa12b603dc596e683f4f9f14f5a9 (diff) | |
download | chromium_src-a3bcff633580fa9afd4653817f497d8a49235994.zip chromium_src-a3bcff633580fa9afd4653817f497d8a49235994.tar.gz chromium_src-a3bcff633580fa9afd4653817f497d8a49235994.tar.bz2 |
MD5Update function uses StringPiece instead of raw buffer.
BUG=none
TEST=base_unittests --gtest_filter=MD5.ContextWithStringData*
Review URL: http://codereview.chromium.org/7466003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/md5.h')
-rw-r--r-- | base/md5.h | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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 |