MD5 32位加密

#pragma mark - MD5 32位加密(NO 小写;YES 大写)
+(NSString *)md5_32:(NSString *)str bool_isUpper:(BOOL)bool_isUpper
{
    constchar *cStr = [str UTF8String];
    unsignedchar result[32];
    CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
    NSMutableString *hash = [NSMutableStringstring];
    for (int i =0; i < 16; i++)
    {
        [hash appendFormat:@"%02X", result[i]];
    }
    if (bool_isUpper) {
        //大写
        return [hashuppercaseString];
    }else{
        //小写
        return [hashlowercaseString];
    }
}


你可能感兴趣的:(MD5加密)