题目

题解
很容易看出这是一个栅栏密码的解密操作,高度为2,则编写以下代码实现:(直接在线网站也可,这里练习一下编程)
def decrypt_fence_cipher(ciphertext, height):
# 计算每个栏的长度
col_length = len(ciphertext) // height
# 创建一个空字符串用于存储解密后的消息
decrypted_text = ''
for i in range(col_length):
for j in range(height):
# 计算当前字符在原始消息中的索引位置
index = i + j * col_length
# 添加当前字符到解密消息中
decrypted_text += ciphertext[index]
return decrypted_text
# 输入要解密的栅栏密码和栅栏的高度
ciphertext = input("请输入栅栏密码:")
height = int(input("请输入栅栏的高度:"))
# 调用解密函数并输出结果
decrypted_text = decrypt_fence_cipher(ciphertext, height)
print("解密后的消息是:", decrypted_text)
请输入栅栏密码:fa{fe13f590lg6d46d0d0}
请输入栅栏的高度:2
解密后的消息是: flag{6fde4163df05d900}
Comments 5 条评论
yandanxvurulmus.z1g4WqDb0zGL
@craft porn oLdAznjZuSslMfeO
@craft porn oxKjOwCtbzNvf
VYJplfZCgOaW
DyQvnTGBKJRFaqj