When I use md5 encrypt the str
, I get the warning:
Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int').
+ (NSString *)md5To32bit:(NSString *)str {
const char *cStr = [str UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, strlen(cStr),digest ); // here I get the warning.
NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[result appendFormat:@"%02x", digest[i]];
return result;
}