15 / 07 / 14
###用的是 andot 的源码,特此鸣谢。
NSString *text = @"Hello World! 你好,中国!"; NSString *key = @"1234567890"; NSString *encrypt_data = [XXTEA encryptStringToBase64String:text stringKey:key sign:YES]; NSString *decrypt_data = [XXTEA decryptBase64StringToString:encrypt_data stringKey:key sign:YES]; NSLog(@"%@", encrypt_data); if ([text isEqual:decrypt_data]) { NSLog(@"success!"); } else { NSLog(@"fail!"); }