| Index: base/md5.cc
|
| diff --git a/base/md5.cc b/base/md5.cc
|
| index 2211a285e5badf8ef181c3910b10c73e347be4ce..754994c0e562b45b2bc4b90cc2a7c612d14ec5a7 100644
|
| --- a/base/md5.cc
|
| +++ b/base/md5.cc
|
| @@ -1,5 +1,8 @@
|
| +// 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
|
|
|
| /*
|
| * This code implements the MD5 message-digest algorithm.
|
| @@ -164,7 +167,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 +278,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);
|
|
|