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); }