描述

在这里插入图片描述
凯撒密码,直接贴之前写的脚本:凯撒密码

脚本

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: moddemod
# datetime: 2019/12/26 下午3:27 
# ide: PyCharm

def encrypt(plaintext):
	# j即为key
    for j in range(26):
        str_list = list(plaintext)
        i = 0
        while i <len(plaintext):
            if not str_list[i].isalpha():
                str_list[i] = str_list[i]
            else:
                a = "A" if str_list[i].isupper() else "a"
                str_list[i] = chr((ord(str_list[i]) - ord(a) + j) % 26 + ord(a))
            i = i + 1

        print(''.join(str_list))


if __name__ == '__main__':
    plaintext = "MSW{byly_Cm_sIol_lYqUlx_yhdIs_Cn_Wuymul_il_wuff_bcg_pCwnIl_cm_u_Yrwyffyhn_guh_cz_sio_quhn_ni_ayn_bcm_chzilguncihm_sio_wuh_dich_om}"
    encrypt(plaintext)

flag如下:
在这里插入图片描述

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐