summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-12-25 13:59:21 +0000
committerskidd13 <skidd13@openttd.org>2007-12-25 13:59:21 +0000
commit7963963d982aed3176d3d05a09bed1293953ef88 (patch)
tree42ac53ed2682fd271d54bb7695ea73ba7053c2af /src/network/network_client.cpp
parentb3f6c0734b2eba2ab6271ea0fbf669a526a33e3c (diff)
downloadopenttd-7963963d982aed3176d3d05a09bed1293953ef88.tar.xz
(svn r11695) -Codechange: Converted the md5 algorithm to OOP
-Codechange: Adapt the md5 algorithm to the OpenTTD source
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index df70842d7..0b830c179 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -56,14 +56,13 @@ static const char *GenerateCompanyPasswordHash(const char *password)
/* Add the game seed and the server's unique ID as the salt. */
for (uint i = 0; i < NETWORK_UNIQUE_ID_LENGTH; i++) salted_password[i] ^= _password_server_unique_id[i] ^ (_password_game_seed >> i);
- md5_state_t state;
- md5_byte_t digest[16];
+ Md5 checksum;
+ uint8 digest[16];
static char hashed_password[NETWORK_UNIQUE_ID_LENGTH];
/* Generate the MD5 hash */
- md5_init(&state);
- md5_append(&state, (const md5_byte_t*)salted_password, sizeof(salted_password));
- md5_finish(&state, digest);
+ checksum.Append((const uint8*)salted_password, sizeof(salted_password));
+ checksum.Finish(digest);
for (int di = 0; di < 16; di++) sprintf(hashed_password + di * 2, "%02x", digest[di]);