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

Side by Side Diff: components/feedback/anonymizer_tool.h

Issue 1530403003: Add anonymizer tool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Vasilii's comments Created 5 years 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
« no previous file with comments | « components/feedback/OWNERS ('k') | components/feedback/anonymizer_tool.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 2015 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 COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
6 #define COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include <base/macros.h>
13
14 namespace feedback {
15
16 class AnonymizerTool {
17 public:
18 AnonymizerTool();
19 ~AnonymizerTool();
20
21 // Returns an anonymized version of |input|. PII-sensitive data (such as MAC
22 // addresses) in |input| is replaced with unique identifiers.
23 std::string Anonymize(const std::string& input);
24
25 private:
26 friend class AnonymizerToolTest;
27
28 std::string AnonymizeMACAddresses(const std::string& input);
29 std::string AnonymizeCustomPatterns(const std::string& input);
30 static std::string AnonymizeCustomPattern(
31 const std::string& input,
32 const std::string& pattern,
33 std::map<std::string, std::string>* identifier_space);
34
35 // Map of MAC addresses discovered in anonymized strings to anonymized
36 // representations. 11:22:33:44:55:66 gets anonymized to 11:22:33:00:00:01,
37 // where the frist thre bytes represent the manufacturer. The last three bytes
vasilii 2015/12/17 13:39:05 spelling
battre 2015/12/17 14:34:56 Done.
38 // are used to distinguish different MAC addresses and are incremented for
39 // each newly discovered MAC address.
40 std::map<std::string, std::string> mac_addresses_;
41
42 // Like mac addresses, identifiers in custom patterns are anonymized.
43 // custom_patterns_[i] contains a map of original identifier to anonymized
44 // identifier for custom pattern number i.
45 std::vector<std::map<std::string, std::string>> custom_patterns_;
46
47 DISALLOW_COPY_AND_ASSIGN(AnonymizerTool);
48 };
49
50 } // namespace feedback
51
52 #endif // COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
OLDNEW
« no previous file with comments | « components/feedback/OWNERS ('k') | components/feedback/anonymizer_tool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698