objective-c md5例子
转自:http://www.cnblogs.com/tracy-e/archive/2011/04/13/1877351.html
@interface NSString (MyExtensions)
- (NSString *) md5;
@end
@implementation NSString (MyExtensions)
- (NSString *) md5
{
const char *cStr = [self UTF8String];
unsigned char result[16];
CC_MD5( cStr, strlen(cStr), result ); // This is the md5 call
return [NSString stringWithFormat:
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
}
@end
相关推荐
84407518 2012-07-16
87214552 2015-10-27
84407518 2016-01-25
89283517 2012-06-19
ObjectiveC 2012-06-14
zhujiangtaotaise 2020-01-01
AllenG 2013-07-07
Beatopcoder 2013-07-14
afrtooylsw 2014-05-14
让编程改变世界 2015-03-13
shqhope 2015-04-09
zoutian00 2015-05-12
huangshm 2019-01-14
86981633 2019-06-29
我的iOS王者之路 2019-06-28
好好学习天天 2019-06-28