Comparing 2 hashes: local and website

01/10/2017 03:10 .Nexitis#1
Hey, i'm about to code a patcher for a server but im struggling.

I need to compare the local client with the uploaded client on the homepage and if they aren't the same it should delete the local one and download the online one.

I know that this is possible with hashes but i don't know how to start.
Google won't really help me i only found out how to compare 2 local hashes.
01/10/2017 09:53 florian0#2
You could also put a version information somewhere on the page. It can be a simple, increasing, number. If the web-version is newer than the local one, just download the client.

If you wanna stick with the hash, just place a checksum file next to the client on the web, that is updated as the client gets updated.
Then calculate the local checksum and compare it to the provided remote checksum.

Calculating the checksum of a remote file on a webspace is not possible. In order to calculate a checksum, you need to process the whole file. So you'll download the file no matter if its newer or not, just to calculate the checksum and then probably discard it most of the time.
01/10/2017 18:26 .Nexitis#3
Thanks for the tip but i need it to work fast.

i need a method to compare the local and the remote file to avoid downloading the complete client over and over again.
01/10/2017 19:07 florian0#4
But I described a way that does not require to download the entire file ...
01/12/2017 14:52 XYZ-Cannon#5
Quote:
Originally Posted by .Nexitis View Post
Thanks for the tip but i need it to work fast.

i need a method to compare the local and the remote file to avoid downloading the complete client over and over again.
"You could also put a version information somewhere on the page. It can be a simple, increasing, number. If the web-version is newer than the local one, just download the client."

Version in client= local variable f.e. int 3.
Webserver has version in remote file f.e int 4.
You check the version with your local client from the webserver.
When you load the client you compare local variable with that one from webserver. 4>3 = download client.
01/21/2017 22:31 Beni#6
keep in mind that this method does not check any integrety of the local files. with your checksum approach that would be (kind of) granted. You could implement that increasing version number first now for the beginning to work, but i'd recommend to update it later on that checksum version.