
Reading assistant
Readme of tap water
Tap water today, what I did not think about this official account at the beginning, but I can't stand this drama frequently in front of my eyes, and even if I searched for it many times, my friends circle, watercress, micro-blog, and some of the big guys who often see the public can see Amway frequently. For those who don't watch the video very much, I just remember a name and don't have the desire to brush it. I had nothing to do last weekend. I remembered this again when I found a meal video, which happened to be recommended on Tencent's home page, After opening it, it got out of hand and stayed up all night to catch up with the play. It was over for a weekend! No wonder Douban's score reached 8.4, and its reputation reached the best in the ancient costume drama broadcast in the same period. I think it's the most brilliant play I'll see when I grow up!
It is also a "three noes" online Drama:
- Cass without big stars,
- Without overwhelming publicity,
- Even the cost is a little "poor",
The logic of the story is very strict, and I didn't treat the audience as stupid *. My literary literacy once made me think I was a fish that missed the nine-year compulsory education. Let's watch the play by myself. Today, I want to talk about the plot of little goldfish decrypting the secret letter of his son-in-law in Episode 21 - Chinese cryptography based on python to realize the inverse rhyme annotation method
Decryption by inverse tangent rhyme annotation
After all, I used to be a Sinology enthusiast. When watching the play, I knew I didn't deserve it when I first heard the anti cutting rhyme annotation method. Baidu was as fierce as a tiger. First, go to the link to explain what the anti cutting rhyme annotation method is. After all, it's not Sinology popular science. I won't copy it here. If you are interested, jump the link directly
- Inverse tangent - Baidu Encyclopedia
- What's the meaning of the inverse rhyme annotation method mentioned in the imperial gift xiaozhuzuo?
Now before we get to the point, we need to understand a Pinyin Library of python:

# Installation Library - Pinyin library and library for removing Chinese punctuation marks !pip install pypinyin -ihttps://pypi.tuna.tsinghua.edu.cn/simple !pip install zhong -ihttps://pypi.tuna.tsinghua.edu.cn/simple # First introduce the maternal poems m1 = "Peach blossom mouth, still water, young son hanging silk, slight ripples and wrinkles, Meiniang picking different, clear waves and floating light." m2 = "Spring flowers fade, summer leaves are wide, and the moon sinks across the bridge. Weishui is nostalgic for autumn, and endless autumn sorrow comes from the clouds. Baling injury, how many Acacia in the misty rain. Gan, hungry, unjust, north, forever" # Here's an explanation. The Internet says that this is Huadian, the password is not right, and the props are made casually. I didn't go deep into this. After all, there are Yangzhou codes and screenshots. The ciphertext is too troublesome, # This is not important. It is mainly due to the lack of vowels in the decryption process: an,e,van, ei, iong # So I added a few words after it # Interestingly, baidu also learned a blind spot of knowledge, triple compound vowels, interested in Baidu # Import library from pypinyin import pinyin # Remove Chinese punctuation marks import re,string from zhon.hanzi import punctuation # The ancient prose has no punctuation. In order to facilitate reading, punctuation is added and removed here m1_ = re.sub(r"[%s]+" %punctuation,"",m1) m2_ = re.sub(r"[%s]+" %punctuation,"",m2) # Since the props mentioned above are made up, we don't analyze the codebook in the play # Here I deducted the contents of the secret letter from my son-in-law and made a reverse analysis, that is, the original password number was analyzed from the contents of the secret letter def get_paswd_info(sentence): """Parsing the phonetic information of the parent""" # Used to store parsed initials shm_list = [] # It is used to store the parsed vowel with tone ym_list = [] # Used to store parsed vowels without tones ym_list_only = [] for word in sentence: # Initials analysis s = pypinyin.pinyin(word,style=pypinyin.INITIALS)[0][0] shm_list.append(s) # Vowel analysis with tone - with tone. The tone is represented by numbers [1-4] after each Pinyin y = pypinyin.pinyin(word,style=pypinyin.FINALS_TONE3)[0][0] ym_list.append(y) # Analysis of vowels without tone y_ = pypinyin.pinyin(word,style=pypinyin.FINALS)[0][0] ym_list_only.append(y_) return shm_list,ym_list,ym_list_only # Secret letter content info = """My name is Xiao Heng. I am the censor of the Wenzong Dynasty. I leave this ciphertext today. I hope that future generations of learned and fearless people can solve the mysteries of the ghost house and break the mess, so that I can sink myself, see the sun, and return the loyal soul of Jiannan to the name of innocence. In the ninth year of Taihe, Emperor Wenzong wanted to eradicate the disaster of the Northern Division. According to a secret decree, I announced Jiannan Festival envoy Chen Ying and led the troops to Beijing for support. Chen Ying took the decree and did it immediately. Unexpectedly, Ganlu was defeated. The official party took the emperor and slaughtered all officials. Chen Ying and her righteous teachers were falsely rebellious. I broke through the encirclement with a secret order, but I was seriously injured by the encirclement. I had to jump off the cliff to survive. Fortunately, I was rescued by a witch doctor who collected medicine. However, I was in a coma for more than a month. When I woke up, I was unable to return to heaven. The eunuch Party tried to lure me to appear in the name of a hero and take my life to destroy the evidence. I was afraid that I would make a wrong step. Instead of redressing my grievances, I would involve more innocent people. Without any choice, after the witch doctor returned to the west, he accepted his mantle and hid in Pingle Town, Guanling County, in order to plan the future. Fortunately, I was taken care of by the Chu family. I dare not forget my heavy trust all day. However, the terrain of Guanling County is dangerous, and there is only one slip rope that connects with the outside world. The search and arrest of the official party forces in the Southwest has never stopped. My legs have been worn out, which is bad for my behavior. The officials of the county have frequently spared the rest of the Jiannan envoys who fled here and hurt the killers. I have never had the opportunity to contact Chang'an. Later, eunuchs tracked me down to my seclusion alone. I killed him by chance and hid his body and murder weapon in the wall of the hospital as evidence. However, the disabled body is getting worse and worse, and the time is running out. Although I am unwilling, I can only make this arrangement. When I write this book, I sink into the mire, take heaven and earth as the coffin, hide my grievances, and hope that future generations can understand the law""" # Similarly, the Chinese punctuation marks are removed from the content of the secret letter info_ = re.sub(r"[%s]+" %punctuation,"",info).replace("\n","") # Analyze the initials and vowels without tone of the ciphertext from the mother text (the first two poems) mw_shm = get_paswd_info(m1_)[0] mw_ym = get_paswd_info(m2_)[2] def creat_mw_num(info,mw_shm,mw_ym): """Construct parsed ciphertext number""" first_num = [] shm = get_paswd_info(info)[0] for i in shm: if i: # Search for position in ciphertext initials first_num.append(mw_shm.index(i)) else: # If there is no initial here, use 0 instead first_num.append(0) second_num = [] ym = get_paswd_info(info)[2] for j in ym: #Search for position in ciphertext vowels second_num.append(mw_ym.index(j)) third_num = [] sd = get_paswd_info(info)[1] for k in sd: # Parsed tone 1-4 third_num.append(k[-1]) # Use zip to compress and unpack return list(zip(first_num,second_num,third_num)) # Input the secret letter and the initials and vowels of the secret text to get the actual secret text of the secret letter of the son-in-law creat_mw_num(info_,mw_shm,mw_ym)
The parsed password is shown in the figure below

# Generate passwords for testing message = "How much reincarnation less one person, how much reincarnation to the world" creat_mw_num(message,mw_shm,mw_ym) def send_message(num_info,mw_shm,mw_ym): """Password transfer information""" info = [] for num in num_info: info.append(mw_shm[num[0]]+mw_ym[num[1]]+num[2]) return info # Test with the previously generated test password num_info = [(3, 32, '3'), (19, 29, '1'), (11, 0, '2'), (1, 14, '2'), (4, 30, '3'), (0, 32, '1'), (20, 8, '2'), (11, 0, '2'), (1, 14, '2'), (3, 32, '3'), (19, 29, '1'), (19, 30, '4'), (21, 36, '2'), (8, 8, '2')] send_message(num_info,mw_shm,mw_ym) # The operation results are shown in the figure below

Write at the end
To sum up, in addition to the Versailles speech when analyzing the secret letter of the book of songs, the little goldfish is definitely a mobile computer, which may be traversed back by robots in the future. Hahaha, the memory, computing power and manpower are sometimes poor!!!!