Yes, it is possible to set the default favorites for a user programmatically. We do it whenever a user is added to the Identity Store. Editing existing favorites for users that have set them up on their own is pretty complicated, though, and we have not attempted that.
The MX_USER_PREFS attribute is Base64 encoded. If you run a To ASCII pass and run the attribute through a script that just outputs the results of the uFromBase64() function, you can look at the formatting of the attribute. It is my understanding that the MD5 hashing of the attribute is just used to try to shorten it to fit within the SQL column requirements. If you run it through the same Base64 decoding, it should still work.
All you need to do to set the favorites is to encode the text in Base64 and write it to the attribute. The important line of our script looks like this:
OutString = uToBase64("EntrySearchComp.Favorite.58.1=768|0|Create User\nComp.Favorite.58.2=792|-100|Edit Existing User\n");
Each favorite is separated by a line break, hence the "\n". The format is:
EntrySearchComp.Favorite.[Entry Type ID].[Button Order]=[Task ID]|[0 for Create, -100 for Edit]|[Button Text]
You can also swap out "Favorite" for "TableSort" and then everything from "Button Order" on is different, some examples there would be .sortColumn=column_5 and also .sortDirection=UP.
There is some header information in the attribute about when it was last edited by the user. In my script code, that is being ignored.