我的cocos2d游戏使用CCCrypt()加密保存数据.我使用mac地址作为加密密钥.在IOS5中加密的保存文件无法使用IOS6中的相同mac地址进行解密.这意味着更新游戏的用户将丢失所有数据!
有没有办法解密旧文件?
这是代码:
@implementation NSData (AESAdditions)
- (NSData*)AES256EncryptWithKey:(NSString*)key {
// 'key' should be 32 bytes for AES256, will be null-padded otherwise
char keyPtr[kCCKeySizeAES256 + 1]; // room for terminator (unused)
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding)
// fetch key data
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];
NSUInteger dataLength = [self length];
//See the doc: For block ciphers, the output size will always be less than or
//equal to the input size plus the size of one block.
//That's why we …Run Code Online (Sandbox Code Playgroud)