import gmpy2 n = 8870619487339789349033932217513908953609539651949986489986889710933094577873155191810742828503059670650154455297603719 c = 6940158573485767169443582872275118843545217792197971962103010557916847970940437712181778807436191892307187137338300231
d = gmpy2.invert(3, euler_phi(n)) m = pow(c, d, n) bytes.fromhex(hex(m)[2:])
import random import gmpy2 random.seed(0x36D) n = 3950848271664122675439855009329233027357977239695163232943132810210035583520735079984423511153607529820284200137188647
Zn = Zmod(n) P = PermutationGroupElement('(1,14,25,8,23,15)(2,22,17)(3,18,13,33,11,30,26,27,10,6,16,31,28,21,29,36,7,9)(4,35,12,32,20,5,24)(19,34)') P = Matrix(Zn, P.matrix()) A = Matrix(Zn, 36, 36, lambda x, y: random.randint(0, 0x36D)) B = A * P * A^-1 c = [...] C = [] for i inrange(36): C.append(c[i*36:(i+1)*36]) C = Matrix(Zn, C) B_inv = B^3 C_new = C / B_inv cc = C_new[0][0]
d = gmpy2.invert(3, euler_phi(n)) m = pow(cc, d, n) bytes.fromhex(hex(m)[2:])
闪电五连鞭·三鞭
1 2 3 4 5 6 7 8 9 10 11 12
# BB = B^3 # BB_inv = BB^(-1) # CC = C * BB_inv
import gmpy2 n = 25126409997644048715497037905442671105116158875704245711785280791201683049008805107543997350200944348915833337286069203 cc = 2440870830361488333405717893137622686904829095539256446436231771058787790530861000815874544642875904753470292396055730 cc = (cc * gmpy2.invert(36, n)) % n
d = gmpy2.invert(3, euler_phi(n)) m = pow(cc, d, n) bytes.fromhex(hex(m)[2:])
闪电五连鞭·四鞭
1 2 3 4 5 6 7 8 9 10 11 12 13
# BB = B^17 # BB_inv = BB^(-1) # CC = C * BB_inv # I.trace() = 88
import gmpy2 n = 8832564044541326030658929702316436880591014904231676570839678873603730471484972295046612326549001678639811100026511993 cc = 5298954238197992022282643920507107154250709069597164746868432885002292554976622438394424965260846005857405245601483810 cc = (cc * gmpy2.invert(88, n)) % n
d = gmpy2.invert(17, euler_phi(n)) m = pow(cc, d, n) bytes.fromhex(hex(m)[2:])
大鸟转转转
为响应群主“怎么简单怎么来”的号召,特补上一道古典密码。
明文密文都是大写字母。
请解出正确的明文后,把明文转换成小写,并加上格式所包含的花括号。
Engima密码机。
python反序列化:
1 2 3 4 5
import pickle x = pickle.load(open('nimage.pickle', 'rb')) print(x)
from pycipher import Enigma import string dic = string.ascii_uppercase
for x in dic: for y in dic: for z in dic: eng = Enigma(settings=('W','Y','F'),rotors=(1,2,3),reflector='B', ringstellung=(x,y,z),steckers=[('W','O'),('D','E'), ('J','B'),('H','N'),('X','I')]) flag = eng.decipher('MXKXBTIOOZHFTGGTTPTRNXJUGASUTVBNSNGS') if flag.startswith('CTFSHOW'): print((x,y,z),flag.lower())
for k in alpha: iford(k)-ord('C') inrange(26): now_php = '' for i inrange(ord(k)-cnt): now_php += '$_++;' cnt += 1 icon = greece[ord(k)-ord('C')] now_php += f'${icon}=$_;' out += now_php
func = [] for k in need: iford(k)-ord('C') inrange(26): icon = greece[ord(k)-ord('C')] func += [f'${icon}'] else: func += [k] func = '.'.join(func) print(func)