【CTF-crypto-维吉尼亚密码】变种题 题目密码表a b c d e f g h i j k l m n o p q r s t uvw x y z{}a a b c d e f g h i j k l m n o p q r s t uvw x y z{}b b c d e f g h i j k l m n o p q r s t uvw x y z{}a c c d e f g h i j k l m n o p q r s t uvw x y z{}a b d d e f g h i j k l m n o p q r s t uvw x y z{}a b c e e f g h i j k l m n o p q r s t uvw x y z{}a b c d f f g h i j k l m n o p q r s t uvw x y z{}a b c d e g g h i j k l m n o p q r s t uvw x y z{}a b c d e f h h i j k l m n o p q r s t uvw x y z{}a b c d e f g i i j k l m n o p q r s t uvw x y z{}a b c d e f g h j j k l m n o p q r s t uvw x y z{}a b c d e f g h i k k l m n o p q r s t uvw x y z{}a b c d e f g h i j l l m n o p q r s t uvw x y z{}a b c d e f g h i j k m m n o p q r s t uvw x y z{}a b c d e f g h i j k l n n o p q r s t uvw x y z{}a b c d e f g h i j k l m o o p q r s t uvw x y z{}a b c d e f g h i j k l m n p p q r s t uvw x y z{}a b c d e f g h i j k l m n o q q r s t uvw x y z{}a b c d e f g h i j k l m n o p r r s t uvw x y z{}a b c d e f g h i j k l m n o p q s s t uvw x y z{}a b c d e f g h i j k l m n o p q r t t uvw x y z{}a b c d e f g h i j k l m n o p q r s u uvw x y z{}a b c d e f g h i j k l m n o p q r s tvvw x y z{}a b c d e f g h i j k l m n o p q r s t u w w x y z{}a b c d e f g h i j k l m n o p q r s t uvx x y z{}a b c d e f g h i j k l m n o p q r s t uvw y y z{}a b c d e f g h i j k l m n o p q r s t uvw x z z{}a b c d e f g h i j k l m n o p q r s t uvw x y{{}a b c d e f g h i j k l m n o p q r s t uvw x y z}}a b c d e f g h i j k l m n o p q r s t uvw x y z{加密脚本importstringfromsecretimportflagfromsecretimportencryptimportrandom dictsstring.ascii_lowercase{}key(.join([random.choice(dicts)foriinrange(4)]))*8assert(len(flag)32)assert(len(key)32)cipherencrypt(flag,key)print(cipher)# tsejk}gbxyiutfchpm}ylm}a}amuxlmg解密密码字典dictsdictsstring.ascii_lowercase{}创建包含所有小写字母和花括号的字符串dicts为abcdefghijklmnopqrstuvwxyz{}生成密钥key (‘’.join([random.choice(dicts) for i in range(4)])) * 8标识四个字符被用了8遍如a19e被使用八遍则为a19ea19ea19ea19ea19ea19ea19ea19e这就是密钥根据其他题目答案猜测前7个明文为ayyctf{由于前五个密文为tsejk}g假设明文为ayyctf{猜测第一个密钥为j猜测第二个密钥为g猜测第三个密钥为u猜测第四个密钥为v从密码表中推断4位密钥jguv完整密钥: jguvjguvjguvjguvjguvjguvjguvjguv计算明文ayyctf{wecanalwaystrustvigenere}