// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_VARIATIONS_ENTROPY_PROVIDER_H_ #define COMPONENTS_VARIATIONS_ENTROPY_PROVIDER_H_ #include <stddef.h> #include <stdint.h> #include <cstdint> #include <optional> #include <string> #include <string_view> #include "base/component_export.h" #include "base/metrics/field_trial.h" namespace variations { // SHA1EntropyProvider is an entropy provider suitable for high entropy sources. // It works by taking the first 64 bits of the SHA1 hash of the entropy source // concatenated with the trial name, or randomization seed and using that for // the final entropy value. class COMPONENT_EXPORT(VARIATIONS) SHA1EntropyProvider : public base::FieldTrial::EntropyProvider { … }; // A |value| in the range [0, range). struct ValueInRange { … }; // NormalizedMurmurHashEntropyProvider is an entropy provider suitable for low // entropy sources (below 16 bits). It uses MurmurHash3_32 to hash the study // name along with all possible low entropy sources. It finds the index where // the actual low entropy source's hash would fall in the sorted list of all // those hashes, and uses that as the final value. For more info, see: // https://docs.google.com/document/d/1cPF5PruriWNP2Z5gSkq4MBTm0wSZqLyIJkUO9ekibeo // // Note: this class should be kept consistent with // NormalizedMurmurHashEntropyProvider on the Java side. class COMPONENT_EXPORT(VARIATIONS) NormalizedMurmurHashEntropyProvider final : public base::FieldTrial::EntropyProvider { … }; class SessionEntropyProvider : public base::FieldTrial::EntropyProvider { … }; class COMPONENT_EXPORT(VARIATIONS) EntropyProviders { … }; } // namespace variations #endif // COMPONENTS_VARIATIONS_ENTROPY_PROVIDER_H_