How to design your encryption software

zhaozj2021-02-11  165

The most important of encrypting data is the design of the key. It is not the details of the algorithm. The security of a good encryption program should only be related to its key, but it has nothing to do with its algorithm, but if the algorithm is not Ok, this will make a lot of opportunities for pedestrians. Since the key is designed to involve many deep math problems, we do not discuss the design of the key here. Next, we will focus on how to design a new encryption software to discuss the following issues. If you have different opinions or better suggestions, I will discuss together, my E-mail is liuwenbin_1@sohu.com.

I. Algorithm: The current encryption software is eight, what is the algorithm, but most of them use public algorithms. But the software author is designed. These algorithms can be said that most of them are very fragile, can only be used to prevent general users, some software use very simple algorithm, if you think that the details of your algorithm can be used, you can pass the sea. The pedients can easily crack it easily. And it is basically not disassembled. From the surface, the files encrypted by various encrypted software are similar, which is to convert the contents of the source file into garbled. This is the so-called ciphertext, but if the correspondence with the source file is very obvious. Then, the pedestrian may be able to see it, and give a source program, use the 16-bit key algorithm (just to illustrate the problem, the algorithm used is very simple),

Void Encrypt (Buffer * /, char password [] / * password * /) {uint PWLEN = Strlen (PASSWORD); // Buffer; // buffer size UINT i = 0; int J = -1; for (; i

The above algorithm can be achieved in its own software, and the speed is very fast. It is characterized by the longer the password, the more confusing the cipher text, and the encryption and decryption use the same algorithm. However, it only uses "secret text chaos" and does not use "Cipher Difficulty" (encrypted basic technology is actually "chaotic" and "proliferation" combination, "confusion" refers to the original characters, " Diffusion "refers to the storage location of characters in the file). If the algorithm uses one of the above two methods, it can be said that it is not safe enough, so the generated cipher is applied to" confusion "and" spread ". We will modify the source and make it also have the "diffusion" function. The program is modified as follows:

Void Encrypt (Buffer * /, char password [] / * password * /) {uint PWLEN = Strlen (PASSWORD); // Buffer; // buffer size UINT i = 0; int J = -1; lpstr tempbuffer = new char [bytelen]; memcpy (tempbuffer, buffer, bytelen); // Copy to temporary buffer for (i = 0; i

The source program is modified as follows: void Encrypt (LPSTR Buffer / * Character Buffer * /, Char Password [] / * Password * /) {uint PWLEN = Strlen (Password); // Password length uint Bytelen = Strlen (buffer); // Buffered size uint i = 0; INT j = -1; if (PWLEN == 0) Return; lpstr tempBuffer = new char [bytelen]; memcpy (TempBuffer, buffer, bytelen); // Copy to temporary buffer SRAND (). Getsecond () ctime :: getcurrenttime (). Getminute ()) // Generate random key seed for (i = 0; i

Second, verify password: Enter the function of password verification in the program, making software use more convenient, more conforming to modern software, but this also creates a very good opportunity to built, broken-handed debugging software such as Soft- ICE to dynamically view the stack variable, so that it is convenient to quickly capture the storage password buffer, which is more than poor rivers. Therefore, there are many software to decrypt the function of the password verification, so although it will increase security, but it will bring inconvenience to the user, because once the error password is lost, the source file will be destroyed, so that the user will back up every time you decrypt Ciphertext file, so it will be a big discount on the ease of use, and another disadvantage is that the built-in chasers can use the garbled code generated by the wrong password to find the loophole of the algorithm, if the algorithm is not good, it is easy to decipherse The corresponding decryption algorithm is found by reverse analysis. This seems to be very contradictory. In fact, for this issue, according to the specific needs, if you master the anti-tracking technology, you can rely on it to escape the tracking of the debug tool, but this is often very difficult, not one or two words can be said Clear, so we don't discuss this here. Interested we can study.

Third, speed: There are some software used algorithms very good, but the speed is very slow, especially when encrypting big files, the speed is quite slow, this is unbearable for users, so we are designing your own procedure. Be sure to add the speed problem to sufficient attention, the speed and complexity of the algorithm are not repellent. For a better than, the current popular encryption algorithm Blowfish is a highly secure public encryption algorithm, which is very fast, but the algorithm is also very complicated (interested friends can download the algorithm source code on the Internet ). The current file is, the greater, if you don't work hard in this area, then the designed software is able to endure. Ok, talk so much nonsense, I should talk about something actually. How can I make an algorithm have a considerable speed? We can observe the above procedure, of course, of course, two for loops, if the character is 1m, then the length of the character is 1,000,000. That is to say, it is necessary to circulate 2,000,000 (each cycle has 1,000,000 times), according to the above algorithm, should not exceed two seconds in the 80586 processor, of course, the premise is to at least 2M or more memory space (including virtual memory) ), If there is a very sufficient memory space, you can do it within a second. Such fast speed is to be in memory overhead (you can get the same speed without too much memory overhead, you have to see your programming skill), as you save memory, add New New The statement, the program is modified to // hypothesis knowing bytelen = 1000000, buffer is an empty character pointer for (i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-5654.html

New Post(0)