//获取文件的Md5值
unsigned char result[16];
NSData *filedata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"国防文书" ofType:@"txt"]];
//创建Md5指针
CC_MD5_CTX md5;
//初始化更新Md5值
CC_MD5_Init(&md5);
CC_MD5_Update(&md5, filedata.bytes, (CC_LONG)filedata.length);
//结束MD5算法
CC_MD5_Final(result, &md5);
//输入加密后的MD5值
NSMutableString *fileStr = [NSMutableString new];
for (int i = 0; i <16; i ++) {
[fileStr appendFormat:@"%02x",result[i]];
}
NSLog(@"%@",fileStr);