MD5加密
必须头文件
#import <CommonCrypto/CommonDigest.h>
// MD5 32位加密
-(NSString *)md5_32:(NSString *)str bool_isUpper:(BOOL)bool_isUpper
{
const char *cStr = [str UTF8String];
unsigned char result[32];
CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
NSMutableString *hash = [NSMutableString string];
for (int i = 0; i < 16; i++)
{
[hash appendFormat:@"%02X", result[i]];
}
if (bool_isUpper) {
return [hash uppercaseString];
}else{
return [hash lowercaseString];
}
}

浙公网安备 33010602011771号