然后写一个生成md5的函数:
class func md5String(str:String) ->String{
var cStr = (stras NSString).UTF8String
var buffer =UnsafeMutablePointer<UInt8>.alloc(16)
CC_MD5(cStr,(CC_LONG)(strlen(cStr)), buffer)
var md5String:NSMutableString =NSMutableString();
forvar i = 0; i <16; ++i{
md5String.appendFormat("%X2", buffer)
}
free(buffer)
returnString(md5String);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wanglixin1999/article/details/47125467