This article describes some of the encryption tips for developing mobile games using Cocos2d-x. If you have any questions, please correct me.
Many other information see: http://blog.csdn.net/chengyingzhilian/article/details/25540441
This address:http://blog.csdn.net/chengyingzhilian/article/details/25957895
Okay, here's the subject of this article-- Data Encryption : to encrypt the data, you have to mention an artifact: eight-door artifact. A golden finger in a mobile game. The eight-door artifact is an Android, IOS, Symbian-based game-changing tool that changes memory values and parameters to change the game's HP, MP, Money, level, and more. Eight-door artifact similar to the PC platform of the Kingsoft Ranger and other game-changing device. for online games, there may not be much impact, the terminal for the online game is basically a fast screen, all the data are stored on the server. This machine only leaves part of the configuration information, such as irrelevant important data. For a single machine, the meaning is not the same, no network can not verify the correct data, very easy to change the data by the memory converter. Therefore, we need to encrypt the data memory we use to prevent the memory from being altered. There are two basic types of data encryption:
- Reversible encryption
- Non-reversible encryption
Two kinds of encryption also correspond to different data encryption design ideas. First you need to understand the basic steps of using the eight-door artifact:
- 1. Discover the data on the interface , go to the eight-door keeper to find.
- 2. Update the data on the interface , enter the eight-door keeper to continue the search in the results of the previous step.
- 3. Repeat step 2 until the result is only a fixed address.
- 4. Change the memory, update the interface to see if the data is correct.
first, reversible encryption:do not know you found the above eight-door artifact using the steps, the red text does not. This is the key to reversible encryption. The first thing to understand is that the data displayed is ~= memory . This is the central idea of reversible encryption. encrypt the data in memory and decrypt it when it is displayed. use one of the simplest reversible algorithms to encrypt and decrypt 2 methods and then encrypt before storing the memory you feel necessary to protect, before decrypting. reversible encryption algorithm: The most typical reversible encryption algorithm is the XOR operation. As we all know, the result is the original value for a continuous difference or two times, so the first XOR is considered as encryption, the second XOR is considered as decryption. This article does not introduce the encryption algorithm, simply introduces the basic idea, about the Advanced encryption algorithm can search by itself. Only one simple algorithm can be used to demonstrate this. Memory * 2The verification method is very easy: start at 1 and increment by 1 each time. With the eight-door artifact, it's very easy to change .then we use a simple algorithm:
- Storage memory = (storage memory/2) * 2
- Display content = memory/2
public class Mainactivity extends Activity {TextView Showtextview = Null;int index = ennum (1); @Overrideprotected void ONCR Eate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); Showtextview = (TextView) Findviewbyid (R.ID.TEXTVIEW2); Showtextview.settext ("" +denum (Index));} public void Addnum (view view) {index = Ennum (Denum (index) +1); Showtextview.settext ("" +denum (Index));} public static int ennum (int num) {return num*2;} public static int denum (int num) {return NUM/2;}}
it's simple. Here we search for eight artifacts:Search after entering 1: there are 202,397 data. After clicking the button, search 2 still has a lot of data,
After clicking the button multiple times, the results of the search will gradually decrease. After that, I can't find it.
Then we use the display = Storage Memory/2 algorithm, search display * 2 of memory, many times after very easy to find the memory.
after the change, the memory changes successfully. Visibility of the importance of cryptographic algorithms. Using simple algorithms, very easy brute force off. Next we look at the way of irreversible encryption: irreversible encryption algorithm: MD5 authentication such as the MD5 algorithm invented by RSA, and the non-reversible encryption Standard SHS (Secure hash standards, secure hash information standard) recommended by the U.S. National Standards Bureau.
Basically it is:Display memory = Storage Memorystore memory encryption is saved in the validation variable. just before each display/use of memory, you control the encryption and validation variables, so that it can be very easy to find whether memory is changed, should take measures and so on.
if (MD5 (index). Equals (Enindex)) {Index++;enindex = MD5 (index); Showtextview.settext ("" +index);} ELSESYSTEM.ERR.PRINTLN ("ERR index changed!!!");
Cell phone encryption that thing. _ Numeric Memory Encryption