所以我有這個功能,這是假設解密密文,但我不知道如何運行此功能,我幾乎不使用python任何幫助將不得不感謝。運行py def和密文
def decrypt1(ctext, key):
if key % 4 == 0:
perm = [4, 1, 3, 6, 7, 5, 2, 0]
elif key % 4 == 1:
perm = [2, 4, 0, 5, 7, 6, 3, 1]
elif key % 4 == 2:
perm = [1, 7, 0, 2, 6, 5, 3, 4]
else:
perm = [5, 4, 1, 7, 0, 2, 3, 6]
rev_perm = [perm.index(i) for i in range(len(perm))]
ptext = ""
for j in range(0, len(ctext), 8):
block = ctext[j: j+8]
ptext += ''.join(block[p] for p in rev_perm)
return ptext
這裏是密文
EHN Aotrf irtmeot米enoiaoig SL SGNN iinis PRGA hmwen rinta FS SSE eelo v aesnothmte phssoot OA ftof爾格的i-terasea lghta小號EP-oifotraht ÑTT瓦特aacomt eeks;他enthsp saisa,eaasbl ihd n tsehssi t grapins gliiintoFe m。 rray m ptn tIdoosip raeoft i,raeytm hr sdo oenek itli cu。噸雙黃連注射劑nasais agisn,dcathe uodwnÿahldil rovydl aihcme isite.if ý即nthrargcinonÑoemed尼vetofs I,rhtemwal升afensip oetootr lrmoatu;是BF atiset˚Frulomainde OE agthwB etvs.udiIy b nouio cslae博士升ehhtestiÑigsnh oayure st aid sy.oupo nt tontral usdgi oo ll wnhaosps hi; eehlavtae eegrttr brpa,dhaein tudtn p seeeh LSTR ORPA RA; nbodi˚Fortb SDI aanibs usem estoeht dtwi ETS IASR gmhaontev ewasehfso噸saaie,B dtisaoyi˚Fuotu PTöTR geaaoö ladnw ogyuranao GN d krhbeatel EAX,oynrad usdga OO opelr sibOdee。 sudv重新erue:masep AO ndroio prtnses我btllnti一個.si HNG
要運行'decrypt1(「你的文本」,「你的密鑰」)' – furas