سؤال

I need the checksum of an XML file in order to verify that no changes have been made to the file.

Once I have created the MD5 checksum is it possible to 'embed' the MD5 checksum inside the very same file. I guess not but perhaps if it is possible to make a partial checksum not based on the first X characters of the file.

Thank you very much...

هل كانت مفيدة؟

المحلول

You can embed an MD5 hash in the file. This will change the hash of the file, but this can be overcome by reversing the modification before verifying the hash, being very careful of course to exactly reverse the operation.

However this doesn't offer any real security because if someone changes the file they just need to remember to change the hash value too.

You should instead generate a keypair and use a digital signature.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top