沙盒文件
NSString *docment = [NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES)objectAtIndex:0];
NSArray *array = @[@"1",@"2"];
NSString *str1Path = [docment stringByAppendingPathComponent:@"array.plist"];
[array writeToFile:str1Path atomically:YES];
創(chuàng)建NSData對(duì)象
NSData *data = [NSData dataWithContentsOfFile:str1Path];
// 1 : 創(chuàng)建一個(gè)MD5的對(duì)象
CC_MD5_CTX md5;
// 2 : 初始化MD5對(duì)象
CC_MD5_Init(&md5);
// 3 : 準(zhǔn)備MD5加密
CC_MD5_Update(&md5, data.bytes, (CC_LONG)data.length);
// 4: 準(zhǔn)備一個(gè)字符串?dāng)?shù)組,存儲(chǔ)MD5加密之后的數(shù)據(jù)
unsigned char resly[CC_MD5_DIGEST_LENGTH];
// 5: 結(jié)束MD5的加密
CC_MD5_Final(resly, &md5);
NSMutableString *resulString = [NSMutableString string];
for (int i = 0; i< CC_MD5_DIGEST_LENGTH; i++) {
[resulString appendFormat:@"%02X", resly[i]];
}
NSLog(@"result ==== %@", resulString);
}