Mercurial > hg > openttd
changeset 16955:b8fc595a0650 draft
(svn r21691) -Codechange: make sure GenerateCompanyPasswordHash() behaves deterministically when/if the value of NETWORK_SERVER_ID_LENGTH is changed
author | smatz <smatz@openttd.org> |
---|---|
date | Sat, 01 Jan 2011 21:38:13 +0000 |
parents | c42d3f94eb23 |
children | 7b0c838febcf |
files | src/network/network_client.cpp |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -312,7 +312,9 @@ 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];