Super-brain hacker

Chapter 220 Encryption Algorithm

For the idea of CQCQ software reconstruction, Lin Hong actually began to slowly take shape in his mind after chatting with Kevin.

It is easier to solve the problem of encrypting sent messages. As far as Lin Hong knows, there are some encryption algorithms with better encryption performance that are free and public, and he can use them directly.

The key is how to establish a "secret stronghold" responsible for the transmission of messages.

These strongholds must have random characteristics and cannot be fixed all the time, which can increase the difficulty of being tracked and intercepted.

Now this mode of one server managing and forwarding the information of all online chat clients will definitely not work, because this structure is too fragile. As long as the other party captures the server, the entire chat network will be paralyzed.

After careful consideration, Lin Hong felt that it was more reliable to return to his original idea, that is, integrating the client and server.

That is to say, how many customers on the network use the whole software, how many message relay servers there are, and each server can relay messages, forming a huge network without any rules.

After determining the general direction, all kinds of inspiration kept coming out of his mind, so that he immediately took out a few blank sheets of paper from his desk and began to record these ideas on the paper in graphic and short words at a very fast speed.

In a short time, the ideas kept coming up were full of five blank sheets of paper, and Lin Hong stopped.

Lin Hong pulled out one of them. On this paper, he drew a network topology diagram representing the computer with squares and lines to indicate the direction of data flow.

Lin Hong turned back, sorted out the previous ideas, and then improved and repaired the picture.

Next, another piece of paper was pulled out. Four squares were drawn on this piece of paper to represent the computer. In the middle, several thin lines were connected with a thick line. The thin line represented a small amount of data exchange, and the thick line represented the real data.

After thinking about it, Lin Hong added two thick lines between them again and crossed out the original thick line.

After a brainstorm just now, Lin Hong has a manuscript of the new version of CQCQ's architecture. The overall design framework has been figured out clearly, and the next step is the implementation of its technical details.

Give up the architecture of the central control server and adopt the point-to-point architecture, and the message can be relayed through each client.

However, there will still be a "relay server side" that maintains the entire topological network node. These servers do not involve the transfer of data, but only save the client node information, such as the IP mapping address, the online node list and the topology between them.

Considering the stability, these servers cannot have only one but more than one, and they jointly maintain the same data table, that is, there are all the backups on each server. In this way, if a server is offline immediately, the entire communication network will not be affected.

Moreover, according to Lin Hong's current assumption, even if all relay servers are shut down or offline, it will not cause the paralysis of the entire communication network, which will affect the immediacy of message transmission at most.

When there is a relay server in the network, the client will stay connected to the relay server in order to know the online status of its friends. When sending information, it will also query the entire topology from the relay server first, and then randomly find one through algorithm calculation. The optimal path sends the message to the destination through this optimal path.

Assuming that all the relay servers are dead, you can't confirm whether your friends are online. When data is transmitted, it is a kind of broadcast behavior, that is, broadcasting your own messages to the whole network. Before transmission, you have to confirm whether the next node is online, and then transmit, and finally it will always reach the purpose you send. Of.

However, in this way, the communication loses its timeliness. It may take a few seconds for a message to be sent out, a few minutes or even ten minutes for the other party to receive it. The length of time is related to the topology of the network.

This structure is also guaranteed in terms of security.

When a message is sent, it will first be encrypted through its own software, and then transmitted to the "transit node". Those nodes are anonymous. After at least five jumps, the source path cannot be found at all. Finally, the message is decrypted from the "export node" and then transmitted to the target client.

In the whole process, the only link that may be monitored is that the last "exit node" assumes that someone is monitoring at the exit node, then the sent message can be intercepted.

Lin Hong also found this shortcoming, so he improved it again when he sorted out the drawings later.

He thought of a solution, that is, after the message is sent, it will be encrypted into a packet, and then the packet will be divided. Each part of the packet will eventually be transmitted to the destination through several different paths. In this way, even if a certain "export node" is monitored, they will intercept only one content. In part, if other packages are not intercepted, the whole package cannot be decrypted at all.

In theory, the possibility of intercepting all packets at the same time is close to zero, so in this way, communication security is guaranteed to the maximum extent.

The whole new architecture designed by Lin Hong not only realizes the anonymity of information transmission, but also eliminates the centralized server side, which greatly improves the confidentiality and stability of the software.

After repeated improvement and optimization, Lin Hong felt that there was no problem in the end, so he began to write code.

Since he doesn't know much about encryption, he temporarily implemented other basic functions and put encryption and decryption at the end.

At dawn, the prototype of the new version of CQCQ was written. The first function is very simple. It can only pass the text version, and it has not been encrypted.

Today is Monday. Lin Hong didn't have many classes. There were no classes after ten o'clock in the morning, so he immediately ran to the school library.

There are two problems to be solved here today.

One is to look up and see if there are any POSIX standard books, and the other is to learn the content of encryption and decryption algorithms.

Because Lin Hong is a regular guest of the library and a member of the SAM team who has been in the limelight recently, many staff in the library are very familiar with him. After seeing him, they greeted him one after another.

Lin Hong smiled and responded that in the past few months, he has completely integrated into the big group of Latin schools. Although there are some flaws here, it is generally more comfortable. Everyone is friendly to each other, and others will be enthusiastic about helping them if they encounter any difficulties.

There is a point that Lin Hong deeply feels that the relationship between students and teachers here is completely equal. Talking to each other is not the kind of listening in China at all, and the other is either a common situation that is either a lecture or a big reason.

Lin Hong came to the computer science area and began to slowly find what he needed.

"POSIX...encryption algorithm..."

Lin Hong said these two words and looked at them in a grid between the bookshelves.

After walking through a few grids, Lin Hong stopped, and a book attracted his attention - "MD5 Algorithm Application".

He took the book in his hand, looked through the foreword and table of contents, then took it in his hand and continued to check the other books on the bookshelf.

After a few laps on the bookshelf corridor, Lin Hong has had several more books in his hand: RSA Encryption Algorithm, Introduction to Encryption Algorithm, Public Key Cryptography, Symmetric and Asymmetric Encryption Algorithm...

When choosing these books, Lin Hong will take a general look at the frontier and catalogues. Originally, he just wanted to study one of them, but it was really difficult for him to choose these books. He thought they were all very good, so he decided to read them simply. Anyway, he reads books very fast.

It's a pity that there are no books about POSIX standards in this library.

In fact, he had expected this for a long time. The science of algorithms is essentially in the field of mathematics. Mathematicians have been conducting research very early, but the specific application implementation has begun to explode in the computer field.

The POSIX standard has only begun to rise in recent years. The circulation is not very large. It is normal that the Latin school library does not have a collection. After all, this is a middle school library, and it is very good to have so many books about algorithms.

As usual, Lin Hong found a relatively remote corner and sat down, and then began to read these books in order.

The first reading is Introduction to Encryption Algorithms, which is relatively easy to understand for beginners. The author specifically reviews the history of the algorithm, focusing on the cryptographic system used by Caesar on the ancient battlefield for military intelligence transmission.

At that time, the password encryption method was relatively simple, that is, simply push a few letters forward or backward to get the ciphertext. When decrypting, the direction can be operated. For example, ABC intelligence, after pushing one encryption back, it becomes BCD. Even if the enemy intercepts this information, if you don't know the original encryption It is difficult to crack the ciphertext.

However, with the development of the times, simple encryption technology naturally cannot meet the requirements, and cracking and anti-cracking technologies are accompanied by development.

After reading the Introduction to Cryptographic Algorithms, Lin Hong continued to read several other books.

At this moment, his brain is running fast, absorbing the knowledge in the book like a sponge.

Lin Hong looked at it, and sometimes he was calculating something on the manuscript paper. He has no obstacles in understanding the content of the book, and even has a feeling that it is too late to meet each other.

He sincerely sighed that the wisdom of his predecessors was really not overwhelming. He had such a profound study of the content in this aspect. If he explored it again, he might not reach this height in his life.

As time went by, Lin Hong completely fell into the world of encryption algorithms and had no sense of what happened outside.