diff options
author | smatz <smatz@openttd.org> | 2011-01-01 21:38:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-01-01 21:38:13 +0000 |
commit | 13456934b1957b6dcd432eaf8a1e85f90fdf1ccf (patch) | |
tree | 8a62359203afee0dedc016b6c71c7ddab7c63269 | |
parent | 7814e6e7925b93ea83f77141649522b69f3c3845 (diff) | |
download | openttd-13456934b1957b6dcd432eaf8a1e85f90fdf1ccf.tar.xz |
(svn r21691) -Codechange: make sure GenerateCompanyPasswordHash() behaves deterministically when/if the value of NETWORK_SERVER_ID_LENGTH is changed
-rw-r--r-- | src/network/network_client.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index fbc5809df..73877dda8 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -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]; |