feat: add obfuscation utilities and precomputed DTOs#238
Merged
leoromanovsky merged 4 commits intomainfrom Feb 3, 2026
Merged
Conversation
Add the foundational data structures and utilities for the precomputed client feature: - ObfuscationUtils: MD5 hashing for flag key obfuscation - PrecomputedFlag: DTO for precomputed flag assignments - PrecomputedBandit: DTO for precomputed bandit assignments - PrecomputedConfigurationResponse: Wire protocol response parsing - BanditResult: Result container for bandit action lookups - MissingSubjectKeyException: Validation exception Includes comprehensive unit tests for serialization round-trips and MD5 hash consistency.
sameerank
approved these changes
Jan 30, 2026
eppo/src/main/java/cloud/eppo/android/util/ObfuscationUtils.java
Outdated
Show resolved
Hide resolved
Add md5HexPrefix() method that only converts the bytes needed for a given prefix length, avoiding unnecessary work when only a prefix is required (e.g., cache file naming uses first 8 chars). Includes unrolled loop for the common 4-byte (8 hex char) case to help compiler optimization, following iOS SDK PR #93 approach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The precomputed client receives server-side computed flag assignments in an obfuscated wire format. This PR adds the data transfer objects (DTOs) and utilities needed to parse and work with this format.
Changes
Utilities:
ObfuscationUtils- MD5 hashing for flag key obfuscation lookupsDTOs:
PrecomputedFlag- Represents a precomputed flag assignment (allocation, variation, type, value, logging config)PrecomputedBandit- Represents a precomputed bandit assignment (action, probability, attributes)PrecomputedConfigurationResponse- Wire protocol response with flags, bandits, salt, and metadataBanditResult- Simple container for bandit action lookup resultsExceptions:
MissingSubjectKeyException- Thrown when subject key is required but not providedTests:
ObfuscationUtilsTest- MD5 hash consistency and standard test vectorsPrecomputedConfigurationResponseTest- Serialization round-trips, null handling, environment parsingDecisions
@JsonCreatorconstructors@JsonIgnoreProperties(ignoreUnknown = true)for forward compatibilityPR Stack
This PR is part of the precomputed client feature, split for easier review:
Why this structure: DTOs and utilities have no dependencies on other new code, making them independently reviewable and testable. They form the "vocabulary" that the rest of the feature uses.