Calculating hash for UserChoice\Hash
Apparently, Windows calculates a hash after assigning a default application that handles files with a given file extension. This hash is stored in the value Hash
under the subkey UserChoice
.
Microsoft decided in Windows 8 (probably for security reasons) that users should be able to set default programs only via the built in GUI. I.e. by design, you are not supposed to be able to set default handlers in a script or programmatically.
Another answer lays out the algorithm for calculating the hash like so:
extension = ".txt” ; The file extension
sid = "S-1-5-21-463486358-3398762107-1964875780-1001" ; The SID of the current user
progid = "txtfile" ; The ProgId of the desired association
regdate = "01d3442a29887400" ; The timestamp of the UserChoice registry key
experience = "a microsoft secret string" ; A static string (this is a dummy example, not the real string
hash = Base64(MicrosoftHash(MD5(toLower(extension, sid, progid, regdate, experience))))
This Stackoverflow answer also links to
this page where an
.exe can be downloaded that apparently is able to calculate this hash.
On the other hand, using
strings
on
SetUserFTA.exe
reveals this string plus a
GUID:
user choice set via windows user experience {d18b6dd5-6124-4341-9318-804003bafa0b}
.