mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21691) -Codechange: make sure GenerateCompanyPasswordHash() behaves deterministically when/if the value of NETWORK_SERVER_ID_LENGTH is changed
This commit is contained in:
parent
7814e6e792
commit
13456934b1
|
@ -312,7 +312,9 @@ static const char *GenerateCompanyPasswordHash(const char *password)
|
||||||
memset(salted_password, 0, sizeof(salted_password));
|
memset(salted_password, 0, sizeof(salted_password));
|
||||||
snprintf(salted_password, sizeof(salted_password), "%s", password);
|
snprintf(salted_password, sizeof(salted_password), "%s", password);
|
||||||
/* Add the game seed and the server's ID as the salt. */
|
/* 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;
|
Md5 checksum;
|
||||||
uint8 digest[16];
|
uint8 digest[16];
|
||||||
|
|
Loading…
Reference in New Issue