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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/feedback/OWNERS ('k') | components/feedback/anonymizer_tool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/feedback/anonymizer_tool.h
diff --git a/components/feedback/anonymizer_tool.h b/components/feedback/anonymizer_tool.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2b225e72d9ecc406d130a0094655219c1a1056b
--- /dev/null
+++ b/components/feedback/anonymizer_tool.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
+#define COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <base/macros.h>
+
+namespace feedback {
+
+class AnonymizerTool {
+ public:
+ AnonymizerTool();
+ ~AnonymizerTool();
+
+ // Returns an anonymized version of |input|. PII-sensitive data (such as MAC
+ // addresses) in |input| is replaced with unique identifiers.
+ std::string Anonymize(const std::string& input);
+
+ private:
+ friend class AnonymizerToolTest;
+
+ std::string AnonymizeMACAddresses(const std::string& input);
+ std::string AnonymizeCustomPatterns(const std::string& input);
+ static std::string AnonymizeCustomPattern(
+ const std::string& input,
+ const std::string& pattern,
+ std::map<std::string, std::string>* identifier_space);
+
+ // Map of MAC addresses discovered in anonymized strings to anonymized
+ // representations. 11:22:33:44:55:66 gets anonymized to 11:22:33:00:00:01,
+ // 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.
+ // are used to distinguish different MAC addresses and are incremented for
+ // each newly discovered MAC address.
+ std::map<std::string, std::string> mac_addresses_;
+
+ // Like mac addresses, identifiers in custom patterns are anonymized.
+ // custom_patterns_[i] contains a map of original identifier to anonymized
+ // identifier for custom pattern number i.
+ std::vector<std::map<std::string, std::string>> custom_patterns_;
+
+ DISALLOW_COPY_AND_ASSIGN(AnonymizerTool);
+};
+
+} // namespace feedback
+
+#endif // COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_
« 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