fix:fix UserChoice Hash algorithm#2
Open
k1988 wants to merge 1 commit into
Open
Conversation
detail: The original code used the 7D60 token-encoding pipeline for BOTH UserChoiceLatest and UserChoice registry keys. But SFTA.ps1 implements UserChoice with a simpler algorithm (no token encoding, different canonical input format, minute-rounded timestamp). Files modified HashCommon.h — Added FILETIME last_write_raw to AssocContext + ComputeHashUserChoice() declaration. HashCodec.cpp — Added ComputeHashUserChoice() implementing the SFTA.ps1 algorithm: - UTF-16LE encode canonical input + null terminator - MD5 directly on raw bytes (no token encoding) - Same MixA/MixB/XOR/Base64 core (reuses existing functions, same seeds) RegistryContext.cpp — Three additions: 1. kUserExperience constant matching SFTA.ps1's experience string 2. FormatTimestampHexMinuteRounded() — rounds FILETIME to minute precision (SFTA.ps1 Get-HexDateTime rounds seconds to 0) 3. BuildCanonicalInputUserChoice() — fixed-format canonical string: assoc + sid + progid + timestamp + experience 4. VerifyCurrentAssociation() now branches: UserChoiceLatest → 7D60 pipeline, UserChoice → SFTA.ps1-compatible algorithm 5. LoadAssociationContext() stores raw FILETIME and uses minute-rounded timestamp for UserChoice key
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.
detail: The original code used the 7D60 token-encoding pipeline for BOTH UserChoiceLatest and UserChoice registry keys. But
SFTA.ps1 implements UserChoice with a simpler algorithm (no token encoding, different canonical input format,
minute-rounded timestamp).
Files modified
HashCommon.h — Added FILETIME last_write_raw to AssocContext + ComputeHashUserChoice() declaration.
HashCodec.cpp — Added ComputeHashUserChoice() implementing the SFTA.ps1 algorithm:
RegistryContext.cpp — Three additions: