the problem of the file hash, could anyone helps ?

Topics: Updater Application Block
Nov 20, 2005 at 9:37 PM
originally posted by: Kent__Liu

hi, i am using the manifest config tool to set using hash, and i make sure the client & server using the same exe file.
but after i saved the manifest file and test in client, every time the same exe is download from server, i traced into the source found that HashAlgorithmProvider.CompareHash return false value.
I've followed the document to set the config file (and using the same security config file between the server & client while using the manifest config tool), i don't know what is wrong with my operation or did i miss anything ?
Cound anyone help me ?
Dec 22, 2005 at 12:00 PM
originally posted by: raulito

I have found that the <location> element in the manifest file is typically set to
<location>.</location>. In my case the hashprovider could not find the file it needed to do the hash comparison on the client.

I set the location in the manifest file to the path of my application files on the client like <location>C:\Program Files\Smart Client\App\</location> it could then find the file, create the hash, and do the comparison.

However, I still cannot get my downloads to work correctly either even after finding this out but I am still working on it.

Feb 22, 2006 at 9:15 PM
originally posted by: Najmir

This is an old post how ever for those who might need a solution the info below may help.

This is probably because salt has been enabled in the HashProvider of your Application Configuration.

Open up your application configuration and select the HashProvider. Set the property "SaltEnabled" to false. Save your configuration and try the updates.

The manfest editor does not seem to append salt (16 bytes) to the hashes it generates. When the Updater Block compares the hashes it takes the 20 byte hash from the manifest and generates a hash for the existing file. Then because salt is enabled its adds an extra 16 bytes to the hash code (for the existing file). The two are then compared and will never be the same becaue one is 36 bytes and the other is 20 bytes. So switching of salt will mean that the extra 16 bytes are not added and the result has the chance to return true when they are equal.

If you have already deployed the application you will need to run an update to update the 'securitycryptographyconfiguration.config' file on the client machines. All successive updates should be able to execute the hash comparison correctly.
Mar 10, 2006 at 7:19 AM
originally posted by: portage

I am a beginner to this.
Do we have to do hash comparsion ourselves in our code or it is already handled in Updater Block?

Mar 10, 2006 at 12:40 PM
originally posted by: Najmir

The hash comparison is handled by the application updater block.

You make use of it via the manifest that you create for the update.