Current location - Quotes Website - Signature design - Is it possible to save the file's own MD5 value in the file?
Is it possible to save the file's own MD5 value in the file?
If you calculate the MD5 value of a text file, then write it into the text file, and then calculate MD5, then the value calculated later will definitely be different from the value originally written into the text file. To make it the same, as the first floor said, it is impossible, and no one can do it. I think what you see should be like this. A text file (such as an article) is followed by an MD5 value, which is used to verify whether the file has been modified. When verifying, you must delete the MD5 value (you can't move it elsewhere), cut it to another place, and then calculate the values of the text file to see if they are the same, so as to ensure the authenticity of the file. If there is, it is too simple, that is, to calculate MD5 first (note that a position should be left in the text file before calculating MD5 to ensure that it will not have any influence on the original text after deletion, including adding and subtracting spaces, etc. ), now open the file and copy the calculated value to that location.