Question

e5a8a742a9ec7a460daad9bee971dac4.jpg

解密结尾的密文

Python

python
cipher="Xkrsg iu xoh xloo,xlkh ju d xay" shifts=[0,4,1,3] out="" i=0 for ch in cipher: if ch.isalpha(): s=shifts[i%len(shifts)] base='A' if ch.isupper() else 'a' out+=chr((ord(ch)-ord(base)-s)%26+ord(base)) i+=1 else: out+=ch print(out)

Python

python
import string cipher="Xkrsg iu xoh xloo,xlkh ju d xay" seqs={"0413":[0,4,1,3],"413":[4,1,3],"20260413":[2,0,2,6,0,4,1,3],"2026413":[2,0,2,6,4,1,3],"4132026":[4,1,3,2,0,2,6],"1304":[1,3,0,4],"3140":[3,1,4,0]} def dec(seq, reset=False, count_non=False): out=""; i=0 for ch in cipher: if ch.isalpha(): s=seq[i%len(seq)] base=65 if ch.isupper() else 97 out+=chr((ord(ch)-base-s)%26+base) i+=1 else: out+=ch if count_non: i+=1 if reset and ch in " ,.;": i=0 return out for name,seq in seqs.items(): for reset in [False, True]: for count in [False, True]: print(name, reset, count, dec(seq,reset,count)) print()

Python

python
def transform(seq, op=1, reset=False, count_non=False): out=''; i=0 for ch in cipher: if ch.isalpha(): s=seq[i%len(seq)]*op base=65 if ch.isupper() else 97 out+=chr((ord(ch)-base+s)%26+base) i+=1 else: out+=ch if count_non:i+=1 if reset and ch in " ,.;": i=0 return out for name,seq in seqs.items(): print(name, transform(seq,1,False,False), transform(seq,1,True,False))

Python

python
plain="There is the hill,high is a way" for seq in ([0,4,1,3],[4,1,3]): out='';i=0 for ch in plain: if ch.isalpha(): base=65 if ch.isupper() else 97 out+=chr((ord(ch)-base+seq[i%len(seq)])%26+base); i+=1 else: out+=ch print(seq,out)

Thought

Exploring possible decryption methods

I’m considering that the cipher "Xkrsg" could be decrypted using a Vigenère key based on the date. I tried using the shifts 4, 1, and 13, which got close to forming "There," but not exactly. I’m wondering if the shifts need to be adjusted or if the message was encrypted differently before the date was applied. The ciphertext might not even be in English.

Thought for 42s

Answer

按题图给出的规则,日期 2026-4-13 应取移位序列 4,1,3(或按示例补零为 0,4,1,3),解密就是反向减去对应位移。

但我按这两种常见理解解出来都不是通顺明文:

  • 4,1,3 循环解密:
    Tjoof fq wld wikn,uhje ft a tzv
  • 用示例格式 04-13 → 0,4,1,3 循环解密:
    Xgqpg et uod wiok,wikd ir d tzv

所以,结尾密文 “Xkrsg iu xoh xloo,xlkh ju d xay” 很可能有抄写/OCR错误,或者题目还有未写出的规则。

如果严格按图片里的“日期滑动移位”规则,不能得到有效明文。建议核对一下密文里的几个字母,尤其是 iu / xoh / xloo / xlkh 这些位置。

Share this Q&A