MD5 IOS
发表于:2024-11-25 作者:热门IT资讯网编辑
编辑最后更新 2024年11月25日,#import +(NSString*)md5:(NSString *)str{const char *cStr = [str UTF8String];unsigned char result[CC_
#import
+(NSString*)md5:(NSString *)str
{
const char *cStr = [str UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
NSMutableString *hash = [NSMutableString string];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[hash appendFormat:@"X", result[i]];
return [hash lowercaseString];
}