How can I count CRC (32 or 64) of an NSData object in Objective-C?
Thanks in advance!
Use crc32()
function from zlib
library:
#import <zlib.h>
NSData *data;
// ...
unsigned long result = crc32(0, data.bytes, data.length);
NSLog(@"CRC32: %lu", result);
Make sure to link libz
library with your project: