对字符的Acssi码值进行简单的处理,进而达到加密的效果. -(NSString *)deCode:(NSString *)filename { NSData *data=[[NSData alloc] initWithContentsOfFile:filename ]; int pw[] = { 1, 2, 3, 4, 9, 5}; NSString *content =@""; int i = 2; while (i + 1 < [data length]) { NSData *subData = [data subdataWithRange:(NSRange){i, 2}]; NSUInteger len = [subData length]; Byte *by=(Byte *)malloc(len); memcpy(by, [subData bytes], len); NSString *temps=[NSString stringWithFormat: @"%c",(((by[1] << 8) + by[0]) - pw[((i-2)/2) % 6]) ]; content=[content stringByAppendingString:temps]; i+=2; } return content; }