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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/util/md5.h

Issue 389863002: Remove Chrome's own version of libaddressinput in favor of the upstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // The original source code is from:
6 // http://src.chromium.org/viewvc/chrome/trunk/src/base/md5.h?revision=94203
7
8 #ifndef I18N_ADDRESSINPUT_UTIL_MD5_H_
9 #define I18N_ADDRESSINPUT_UTIL_MD5_H_
10
11 #include <string>
12
13 namespace i18n {
14 namespace addressinput {
15
16 // MD5 stands for Message Digest algorithm 5.
17 // MD5 is a robust hash function, designed for cyptography, but often used
18 // for file checksums. The code is complex and slow, but has few
19 // collisions.
20 // See Also:
21 // http://en.wikipedia.org/wiki/MD5
22
23 // These functions perform MD5 operations. The simplest call is MD5Sum() to
24 // generate the MD5 sum of the given data.
25 //
26 // You can also compute the MD5 sum of data incrementally by making multiple
27 // calls to MD5Update():
28 // MD5Context ctx; // intermediate MD5 data: do not use
29 // MD5Init(&ctx);
30 // MD5Update(&ctx, data1, length1);
31 // MD5Update(&ctx, data2, length2);
32 // ...
33 //
34 // MD5Digest digest; // the result of the computation
35 // MD5Final(&digest, &ctx);
36 //
37 // You can call MD5DigestToBase16() to generate a string of the digest.
38
39 // The output of an MD5 operation.
40 struct MD5Digest {
41 unsigned char a[16];
42 };
43
44 // Used for storing intermediate data during an MD5 computation. Callers
45 // should not access the data.
46 typedef char MD5Context[88];
47
48 // Computes the MD5 sum of the given data buffer with the given length.
49 // The given 'digest' structure will be filled with the result data.
50 void MD5Sum(const void* data, size_t length, MD5Digest* digest);
51
52 // Initializes the given MD5 context structure for subsequent calls to
53 // MD5Update().
54 void MD5Init(MD5Context* context);
55
56 // For the given buffer of |data| as a StringPiece, updates the given MD5
57 // context with the sum of the data. You can call this any number of times
58 // during the computation, except that MD5Init() must have been called first.
59 void MD5Update(MD5Context* context, const std::string& data);
60
61 // Finalizes the MD5 operation and fills the buffer with the digest.
62 void MD5Final(MD5Digest* digest, MD5Context* context);
63
64 // Converts a digest into human-readable hexadecimal.
65 std::string MD5DigestToBase16(const MD5Digest& digest);
66
67 // Returns the MD5 (in hexadecimal) of a string.
68 std::string MD5String(const std::string& str);
69
70 } // namespace addressinput
71 } // namespace i18n
72
73 #endif // I18N_ADDRESSINPUT_UTIL_MD5_H_
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/src/util/json.cc ('k') | third_party/libaddressinput/chromium/cpp/src/util/md5.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698