如题,上OC代码:
- (NSString *)lowerMD5{
const char *cStr = [self UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, (unsigned int)self.length, digest );
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;
}
服务端采用PHP 的md5
经过http://www.cmd5.com/ 的验证,OC的汉字加密也是对不上
看看客户端的字符集与服务端的是否一致,不一致的话是会导致加密结果不同