| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/rappor/reports.h" | 5 #include "components/rappor/reports.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "components/rappor/byte_vector_utils.h" | 10 #include "components/rappor/byte_vector_utils.h" |
| 11 #include "components/rappor/rappor_parameters.h" | 11 #include "components/rappor/public/rappor_parameters.h" |
| 12 | 12 |
| 13 namespace rappor { | 13 namespace rappor { |
| 14 | 14 |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 ByteVector GenerateReport(const std::string& secret, | 17 ByteVector GenerateReport(const std::string& secret, |
| 18 const NoiseParameters& parameters, | 18 const NoiseParameters& parameters, |
| 19 const ByteVector& value) { | 19 const ByteVector& value) { |
| 20 // Generate a deterministically random mask of fake data using the | 20 // Generate a deterministically random mask of fake data using the |
| 21 // client's secret key + real data as a seed. The inclusion of the secret | 21 // client's secret key + real data as a seed. The inclusion of the secret |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 // Create a randomized response report on the fake and redacted data, sending | 45 // Create a randomized response report on the fake and redacted data, sending |
| 46 // the outcome of flipping a zero coin for the zero bits in that data, and of | 46 // the outcome of flipping a zero coin for the zero bits in that data, and of |
| 47 // flipping a one coin for the one bits in that data, as the final report. | 47 // flipping a one coin for the one bits in that data, as the final report. |
| 48 return *ByteVectorMerge(*fake_and_redacted_bits, zero_coins, &one_coins); | 48 return *ByteVectorMerge(*fake_and_redacted_bits, zero_coins, &one_coins); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace internal | 51 } // namespace internal |
| 52 | 52 |
| 53 } // namespace rappor | 53 } // namespace rappor |
| OLD | NEW |