Index: base/md5.cc |
diff --git a/base/md5.cc b/base/md5.cc |
index 2211a285e5badf8ef181c3910b10c73e347be4ce..c822d5432c55e085990b7f6bc689e65b8b28f60e 100644 |
--- a/base/md5.cc |
+++ b/base/md5.cc |
@@ -1,3 +1,7 @@ |
+// Copyright (c) 2011 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. |
+ |
// The original file was copied from sqlite, and was in the public domain. |
// Modifications Copyright 2006 Google Inc. All Rights Reserved |
brettw
2011/07/26 04:35:58
Just remove the "Modifications Copyright 2006 Goog
|
@@ -164,7 +168,9 @@ void MD5Init(MD5Context* context) { |
* Update context to reflect the concatenation of another buffer full |
* of bytes. |
*/ |
-void MD5Update(MD5Context* context, const void* inbuf, size_t len) { |
+void MD5Update(MD5Context* context, const StringPiece& data) { |
+ const unsigned char* inbuf = (const unsigned char*)data.data(); |
+ size_t len = data.size(); |
struct Context *ctx = (struct Context *)context; |
const unsigned char* buf = (const unsigned char*)inbuf; |
uint32 t; |
@@ -273,11 +279,12 @@ std::string MD5DigestToBase16(const MD5Digest& digest) { |
void MD5Sum(const void* data, size_t length, MD5Digest* digest) { |
MD5Context ctx; |
MD5Init(&ctx); |
- MD5Update(&ctx, static_cast<const unsigned char*>(data), length); |
+ MD5Update(&ctx, |
+ StringPiece(reinterpret_cast<const char*>(data), length)); |
MD5Final(digest, &ctx); |
} |
-std::string MD5String(const std::string& str) { |
+std::string MD5String(const StringPiece& str) { |
MD5Digest digest; |
MD5Sum(str.data(), str.length(), &digest); |
return MD5DigestToBase16(digest); |