公告
财富商城
积分规则
提问
发文
2019-01-14 02:53发布
孤傲高冷的网名
How can I count CRC (32 or 64) of an NSData object in Objective-C?
Thanks in advance!
From iOS11 use this:
unsigned long result = crc32_z(0, data.bytes, data.length);
Use crc32() function from zlib library:
crc32()
zlib
#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:
libz
Have a look here for a CRC32 for NSData
http://classroomm.com/objective-c/index.php?action=printpage;topic=2891.0
最多设置5个标签!
From iOS11 use this:
Use
crc32()
function fromzlib
library:Make sure to link
libz
library with your project:Have a look here for a CRC32 for NSData
http://classroomm.com/objective-c/index.php?action=printpage;topic=2891.0