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

Side by Side Diff: base/md5.cc

Issue 6410105: run iwyu on base! Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/mac/os_crash_dumps.cc ('k') | base/memory_debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // The original file was copied from sqlite, and was in the public domain. 1 // The original file was copied from sqlite, and was in the public domain.
2 // Modifications Copyright 2006 Google Inc. All Rights Reserved 2 // Modifications Copyright 2006 Google Inc. All Rights Reserved
3 3
4 /* 4 /*
5 * This code implements the MD5 message-digest algorithm. 5 * This code implements the MD5 message-digest algorithm.
6 * The algorithm is due to Ron Rivest. This code was 6 * The algorithm is due to Ron Rivest. This code was
7 * written by Colin Plumb in 1993, no copyright is claimed. 7 * written by Colin Plumb in 1993, no copyright is claimed.
8 * This code is in the public domain; do with it what you wish. 8 * This code is in the public domain; do with it what you wish.
9 * 9 *
10 * Equivalent code is available from RSA Data Security, Inc. 10 * Equivalent code is available from RSA Data Security, Inc.
11 * This code has been tested against that, and is equivalent, 11 * This code has been tested against that, and is equivalent,
12 * except that you don't need to include two pages of legalese 12 * except that you don't need to include two pages of legalese
13 * with every copy. 13 * with every copy.
14 * 14 *
15 * To compute the message digest of a chunk of bytes, declare an 15 * To compute the message digest of a chunk of bytes, declare an
16 * MD5Context structure, pass it to MD5Init, call MD5Update as 16 * MD5Context structure, pass it to MD5Init, call MD5Update as
17 * needed on buffers full of bytes, and then call MD5Final, which 17 * needed on buffers full of bytes, and then call MD5Final, which
18 * will fill a supplied 16-byte array with the digest. 18 * will fill a supplied 16-byte array with the digest.
19 */ 19 */
20 20
21 #include <stddef.h>
22 #include <string.h>
21 #include <string> 23 #include <string>
22 24
25 #include "base/basictypes.h"
23 #include "base/md5.h" 26 #include "base/md5.h"
24 27
25 #include "base/basictypes.h"
26
27 struct Context { 28 struct Context {
28 uint32 buf[4]; 29 uint32 buf[4];
29 uint32 bits[2]; 30 uint32 bits[2];
30 unsigned char in[64]; 31 unsigned char in[64];
31 }; 32 };
32 33
33 /* 34 /*
34 * Note: this code is harmless on little-endian machines. 35 * Note: this code is harmless on little-endian machines.
35 */ 36 */
36 static void byteReverse(unsigned char *buf, unsigned longs){ 37 static void byteReverse(unsigned char *buf, unsigned longs){
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 MD5Init(&ctx); 271 MD5Init(&ctx);
271 MD5Update(&ctx, static_cast<const unsigned char*>(data), length); 272 MD5Update(&ctx, static_cast<const unsigned char*>(data), length);
272 MD5Final(digest, &ctx); 273 MD5Final(digest, &ctx);
273 } 274 }
274 275
275 std::string MD5String(const std::string& str) { 276 std::string MD5String(const std::string& str) {
276 MD5Digest digest; 277 MD5Digest digest;
277 MD5Sum(str.data(), str.length(), &digest); 278 MD5Sum(str.data(), str.length(), &digest);
278 return MD5DigestToBase16(digest); 279 return MD5DigestToBase16(digest);
279 } 280 }
OLDNEW
« no previous file with comments | « base/mac/os_crash_dumps.cc ('k') | base/memory_debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698