博客> iOS_MD5加密
iOS_MD5加密
2018-11-13 00:56 评论:0 阅读:720 OS_JJ
ios 纯代码启动页launchImage

十六位加密

    - (NSString *)md5:(NSString *)str
{
    const char *cStr = [str UTF8String];
    unsigned char result[16];
    CC_MD5(cStr, strlen(cStr), result); // This is the md5 call
    return [NSString stringWithFormat:
            @"xxxxxxxxxxxxxxxx",
            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]
            ];
}

-(void)logoinButtonClick
{
    [self.view endEditing:YES];
    NSString *str =[self md5:self.passWordTF.text];
    NSString *str1 = [self md5:str];
    //-substringWithRange: //按照所给出的位置,长度,任意地从字符串中截取子串
    NSString *string2 = [str1 substringWithRange:NSMakeRange(8, 16)];

   加密后调用 string2
    [ZYHTTPRequest request:LOGIN_URL(self.phoneTF.text, string2) Completion:^(NSDictionary *dict) {}
}
收藏
0
sina weixin mail 回到顶部