Skip to content

Commit

Permalink
remove md5 new
Browse files Browse the repository at this point in the history
tested that sqlite hash is still calculated
  • Loading branch information
EmosewaMC committed May 1, 2024
1 parent 35c4636 commit 6943e20
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions dWorldServer/WorldServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,24 +282,22 @@ int main(int argc, char** argv) {
}

const int32_t bufferSize = 1024;
MD5* md5 = new MD5();
MD5 md5;

char fileStreamBuffer[1024] = {};

while (!fileStream.eof()) {
memset(fileStreamBuffer, 0, bufferSize);
fileStream.read(fileStreamBuffer, bufferSize);
md5->update(fileStreamBuffer, fileStream.gcount());
md5.update(fileStreamBuffer, fileStream.gcount());
}

fileStream.close();

const char* nullTerminateBuffer = "\0";
md5->update(nullTerminateBuffer, 1); // null terminate the data
md5->finalize();
databaseChecksum = md5->hexdigest();

delete md5;
md5.update(nullTerminateBuffer, 1); // null terminate the data
md5.finalize();
databaseChecksum = md5.hexdigest();

LOG("FDB Checksum calculated as: %s", databaseChecksum.c_str());
}
Expand Down

0 comments on commit 6943e20

Please sign in to comment.