How to add / save a checksum in a file?

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

Can someone point me in the right direction, how to add the checksum to the file, read / check the file correctly?

+4
source share
1 answer

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

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

+4
source

Source: https://habr.com/ru/post/1386389/


All Articles