Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I add / maintain a checksum on a file?

I have some data I need to put into a file, however I want to ensure that the data remains intact. Either from corruption or from a user modifying the file.

Can someone point me in the right direction, of how to add a checksum to a file, read / check the file is correct?

like image 305
Jules Avatar asked Oct 10 '22 05:10

Jules


1 Answers

You can use the MD5 hash, that's the best option. Here is how to create a MD5 hash from NSString, NSData or a File:

http://iosdevelopertips.com/core-services/create-md5-hash-from-nsstring-nsdata-or-file.html

like image 180
Rafa de King Avatar answered Oct 13 '22 11:10

Rafa de King