[C language project combat] C language to achieve file encryption

file encryption

Case description

In recent years, incidents of property damage caused by information leakage have occurred from time to time. With the development of science and technology, the dissemination and acquisition of information becomes more and more convenient. In order to prevent various crises caused by information leakage, information encryption technology should be given full attention. This case requires designing a program to encrypt and decrypt existing files.

case study

The purpose of file encryption is to ensure the security of information. The principle of encryption is to modify the information in the source file according to a certain principle, so that the encrypted file will not directly reflect the source when it is still in contact with the source file. The information stored in the file, and the encrypted file can restore the content of the source file according to a certain principle.

Case realization

According to the case analysis, the files in this case can be divided into three: source files, encrypted files and decrypted files.

Use XOR to encrypt the source file. In order to ensure the integrity of the source file, the encrypted information is stored in a new file, so the result of the operation is stored in the encrypted file.

If you want to obtain the information stored in the source file based on the encrypted file, you need to read the characters in the encrypted file one by one, make it XOR with the password again, and obtain the decrypted information.

Case code

 

Guess you like

Origin blog.csdn.net/weixin_54707168/article/details/114969687