iOS 中使用md5加密
2014-12-26 08:55
211 查看
#import <CommonCrypto/CommonDigest.h>
@implementation MD5Util
+(NSString *)encode:(NSString *)value{
[value retain];
const char *cStr = [value UTF8String];
[value release];
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
@implementation MD5Util
+(NSString *)encode:(NSString *)value{
[value retain];
const char *cStr = [value UTF8String];
[value release];
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
相关文章推荐
- IOS 密码使用MD5加密
- iosMD5加密使用
- iOS 使用 md5加密
- 简单讲解iOS应用开发中的MD5加密的相关使用
- iOS中使用MD5加密字符串
- iOS开发 关于MD5加密的相关使用
- IOS网络笔记--base64编码和MD5加密的使用方法
- iOS开发之MD5加密的使用
- 【代码笔记】iOS-使用MD5加密
- 【代码笔记】iOS-使用MD5加密
- iOS--使用MD5加密
- iOS使用MD5加密
- 简单讲解iOS应用开发中的MD5加密的相关使用
- iOS开发——用户信息使用MD5加密
- ASP.NET使用MD5加密用户验证
- 使用MD5加密注册用户密码的简单示例
- iOS_MJRefrash的详解以及使用
- 使用SQL2005自带扩展函数对字符串进行MD5加密(转)
- .net 中使用md5加密