What worries me is this:
void CPreferences::CreateUserHash()
{
for (int i = 0;i != 8; i++) {
uint16 random = rand();
memcpy(s_userhash.GetHash()+(i*2),&random,2);
}
// mark as emule client. that will be need in later version
s_userhash[5] = 14;
s_userhash[14] = 111;
}
The comment there says that the new userhashes created by amule will follow a pattern (its not completely random, or pseudo-random I think you called it). The problem is my old userhash (the one I'm bringing from MLdonkey) wont have those "marks". The comment also says that those marks in the hash will be needed later. I dont know how long that comment has been there, so if it was added (for example) 2 years ago, then the userhash marks might be needed now.
I found this, for example, at line 880 in Preferences.cpp:
This comes AFTER loading the userhash from the Preferences.dat file:
LoadPreferences(); // Line 865
... .... .... ... ...
s_userhash[5] = 14; // Line 880
s_userhash[14] = 111;
if (s_userhash.IsEmpty()) {
CreateUserHash();
}
Im not sure why someone would want to modify the userhash after creating or loading it, since it should be correct, but the fact is that will end my effort to modify the userhash on the file with the one I got from MLdonkey. Of course, I could modify this code too, but still I dont know if there are more places in the code where that happens or where the code tests that the userhash is "emulish".
PS: Thanks for javamet.jar