(svn r21691) -Codechange: make sure GenerateCompanyPasswordHash() behaves deterministically when/if the value of NETWORK_SERVER_ID_LENGTH is changed

This commit is contained in:
smatz 2011-01-01 21:38:13 +00:00
parent 7814e6e792
commit 13456934b1
1 changed files with 3 additions and 1 deletions

View File

@ -312,7 +312,9 @@ static const char *GenerateCompanyPasswordHash(const char *password)
memset(salted_password, 0, sizeof(salted_password));
snprintf(salted_password, sizeof(salted_password), "%s", password);
/* Add the game seed and the server's ID as the salt. */
for (uint i = 0; i < NETWORK_SERVER_ID_LENGTH - 1; i++) salted_password[i] ^= _password_server_id[i] ^ (_password_game_seed >> i);
for (uint i = 0; i < NETWORK_SERVER_ID_LENGTH - 1; i++) {
salted_password[i] ^= _password_server_id[i] ^ (_password_game_seed >> (i % 32));
}
Md5 checksum;
uint8 digest[16];