OLD | NEW |
---|---|
(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(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 three bytes represent the manufacturer. The last three | |
vasilii
2015/12/17 14:38:23
first
| |
38 // bytes are used to distinguish different MAC addresses and are incremented | |
39 // for 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_ | |
OLD | NEW |