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

Side by Side Diff: chrome/browser/sync/util/crypto_helpers.h

Issue 6873156: Move crypto_helpers from sync to base (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Follow bbretw review Created 9 years, 7 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 | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/util/crypto_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SYNC_UTIL_CRYPTO_HELPERS_H_
6 #define CHROME_BROWSER_SYNC_UTIL_CRYPTO_HELPERS_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 // An object to handle calculation of MD5 sums.
13 #include "base/basictypes.h"
14 #include "base/md5.h"
15 #include "base/port.h"
16
17 class MD5Calculator {
18 protected:
19 MD5Context context_;
20 std::vector<uint8> bin_digest_;
21
22 void CalcDigest();
23 public:
24 MD5Calculator();
25 ~MD5Calculator();
26 void AddData(const uint8* data, int length);
27 void AddData(const char* data, int length) {
28 AddData(reinterpret_cast<const uint8*>(data), length);
29 }
30 std::string GetHexDigest();
31 const std::vector<uint8>& GetDigest();
32 private:
33 DISALLOW_COPY_AND_ASSIGN(MD5Calculator);
34 };
35
36 void GetRandomBytes(char* output, int output_length);
37 std::string Generate128BitRandomHexString();
38
39 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTO_HELPERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/util/crypto_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698