Joke Collection Website - Cold jokes - How to encrypt a Chinese sentence with Caesar password?
How to encrypt a Chinese sentence with Caesar password?
Caesar cipher, as one of the oldest symmetric encryption systems, has been very popular in ancient Rome. His basic idea is to realize encryption and decryption by moving a certain number of letters. All the letters in plaintext are moved backward (or forward) by a fixed number in the alphabet, and then replaced by ciphertext. For example, when the offset is 3, all the letters of A will be replaced by D, B will become E, and so on, X will become A, Y will become B, and Z will become C. In this way, the number of digits is the key to Caesar's encryption and decryption. I have a question about "how to encrypt a Chinese sentence with Caesar password". In fact, there are many solutions, such as the simple shift of the words "big, windy, square ..." in the array. In fact, after searching, I chose to complete it with transformation. That is, you can use the character code corresponding to Chinese characters for conversion operation, so that Chinese characters are still produced. For example, the Chinese character "One" is 0x4e00. If Caesar shifts to 1, 0x4e00+ 1=0x4e0 1, the corresponding Chinese character is "Ding", if he shifts to three, it is 0x4e03, and the corresponding Chinese character is "Seven". Convert integers within the range of Chinese characters into hexadecimal strings of 16 as suffixes, and add \u in front to form corresponding unicode values. This code is not complicated, but the problem is that when I call the main function, the comment line (as shown below) can't make me remove the escape character, that is, the final output is in the form of \u593a, instead of the "too" corresponding to the unicode value. Just change the "\" in the message to "\", and I think Unicode can be exported to Chinese normally. The first thing that comes to mind is the use of strings. I used ("\ \", "\"), but I found that the output did not change. The solution is: check the API documentation, and the definition of the method is: public string replacement all (string regex, string replacement).
- Previous article:Rural dialogue joke
- Next article:Funny classic jokes between lovers
- Related articles
- The most handsome joke
- Misunderstanding story 150 words
- How much can Shanghai's demolition compensate?
- Is the relationship between Jia Xiuquan and Shoupeng Wang as bad as described by the fans?
- Love battle scene joke
- Youth, where are you?
- What can't I do when menstruation comes?
- The most classic funny joke
- Why do leaders like to poke shit sticks?
- An old joke