其他分享
首页 > 其他分享> > [HBNIS2018]caesar

[HBNIS2018]caesar

作者:互联网

[HBNIS2018]caesar

image-20220730232701203

直接凯撒密码脚本爆破这段字符gmbhjtdbftbs

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 = "gmbhjtdbftbs"
    encrypt(plaintext)

image-20220730232749008

flag{flagiscaesar}

标签:HBNIS2018,26,gmbhjtdbftbs,plaintext,list,caesar
来源: https://www.cnblogs.com/Jinx8823/p/16536165.html