iOS-MD5 32位加密

  • Post author:
  • Post category:其他


#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];
    }
}



版权声明:本文为MinggeQingchun原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。