// 对输入的密码进行简单加密:将字符变为ASCII 代码后,再根据密码对应位数加上一个EncryptKey 中的数值,然后将得到的数据转为16进制字串转出
- (NSString *)encryptPassword{
NSString *encryptKey, *newChar;
encryptKey = @"12345678901234567890";
int asciiCode, loopIndex, charCount, asciiCode2;
NSString *password = userPassword.text;
charCount =[password length];
NSString *newPassword=[[NSString alloc] init];
NSString *hexString = [[NSString alloc] init];
for (loopIndex=0; loopIndex<charCount; loopIndex++) {
asciiCode=[password characterAtIndex:loopIndex];
asciiCode2 = [encryptKey characterAtIndex:loopIndex];
asciiCode = asciiCode + asciiCode2 - 48 ;
hexString = [NSString stringWithFormat:@"%@",[[NSString alloc] initWithFormat:@"%1x",asciiCode]];
//NSLog(@"pwdToHex===%@",hexString);
newPassword=[newPassword stringByAppendingString:hexString];
}
return newPassword;
}