The company's Protocol security requirements require des and md5 encryption for the transmitted content. This is because I was a newbie and was a little dizzy when I handed it over to me. We started to find various des encrypted content on the Internet. Because I don't understand it, I think I need to understand the principles, and finally I am confused by the time. Of course, if you are interested in strong logic, you can try it out. There are many encryption methods on the Internet. as developers, you only need to know how to use them. The first time I wrote articles, beautiful statements, and so on, I would like to show myself ugly again. Let's go straight into the question. First paste the source Code for encryption and decryption: View Code is the first contact with des and the requirements of the company's Protocol documentation, so I am confused about this Code: 1: the two parameters Text are the sKey of the content to be encrypted as the key of the encrypted content. Of course, the sKey values during encryption and decryption must be consistent. 2: The key value of the des object. The key value and the IV value are fixed 8-bit lengths, so be sure to keep them in mind. Because our parameter sKey is of an indefinite length, we adopt MD5 encryption and then intercept the first eight digits. This is to ensure key consistency during decryption. Otherwise, the decryption fails. Finally, let me talk about some of the things that I remember as a newbie, maybe some of the things necessary to write des in the eyes of many people ~~ Don't spray me, a few necessary objects: DESCryptoServiceProvider doesn't have it. What do you think about des? The Stream object CryptoStream stored in memory defines linking data streams to encrypted conversion streams. It writes the MemoryStream object and finally converts it to a String. This is the case. I also have a lot of questions. You are welcome to discuss them with us.