shanghai
题目描述:维吉利亚密码
bju lcogx fisep vjf pyztj sdgh 13 gifc qsxw. pkiowxc
glv jqtio ekpy-hfgcouibkh qijgzkfoqur bj r twnovtvlnfvxqe sdxnie arw nqhhcregiu fg nujv hegxzwbc qgjkvgm rvwwdy 1467 ith hwvh i ouoir gvtyiz fynk zs fazxkj rzbcirr tmxjum irtuesibu. qgjkvgm'j wgujzu uryc jaqvscmj eytyejgjn ilxrv jidghvt csehj, evf irqzguij amtu dvjmpekil do rzoxvrx xpg bzbzie sw xpg sjzxiftfrlkdb irtuesib kd opk gvtyizvusb. regii, mv 1508, lecitrrw kvqvxzuoyf, me lqu mjzq tbpzkzcfcqg, mazvrbgt opk xnflpi tuxbg, e pvzxqeqg kuqcseivv ea bni imxivètu xqvlrv. klm vhdbnizmlw kkfcmx, lbavzmt, eite tesmmlgt v xxstvvwaklz, zokvh rrl rhzloggespm uonbkq ssi wekjxport fvxegui kotuii etrxvjkxf.[gzxivyjv tirhvh]
ejqo qy rba brwyd va zlr zzkmpèhz kotuii aiu emqmmaecpg funkxmoiu fg iyjdgr oekxqujv jkpyejs qp xda 1553 hsbo ce kkvmi jiy wzk. okeqit fnxkmavq wmrpnwf.[4] lm dkdtz ycse xpg jvjapn vvgbc ea bxmglvqqwi wcz eqhvh i tukmgxvrx "gwwdomxwvke" (e sgo) ow yavxtl kkfcmx eytyejgjn mbiec cibvum. enieirw inrzzzm nru xzkjcmsmhw lwmf q aqdiq trxbghi wl whfjxqvkoqurf, fvptcij'a yguidi ugqib zlr trxbghi wl whfjxqvkoqurf gfytf rz mgwvpp gpcdbmj, wvqgpg do nmripxzro c dze qil. ovca yumm zccmtetno nqtkyi nszfi jz ylbvk tptqnmy, oasnr bq rjbn tnvkmmu yi ijznrti, wt jmitwzmkxmf "epb uj oeeh" ineio cmgl klm ounagkr. fvptcij'a siglfh bjkn zkuhmiil ujmwtk fityzkjt nuv brcc bju fme. ef mk ma tugizmiicc mcit bu wrglvm c icwxx xip tptqnm, yypl rw ja q kzkzvslw xtyqizi psezmtivbosa, fvptcij'a ycfxvq eci xwtwvhvvidbt uuvr wvgctu.[xqzegmfr vguymj]
fyezwm fu qqmiaèvv tcdbdaniq lzw lgixzotgmfr wh q nqsmyei fcv iozurtii ecvefme gvtyiz duawxi glv gwwho wl lrric qky jn lvnrti, qp 1586.[5] bvbkv, vr klm 19vx xmtxhvp, xpg yidkrgmfr wh rztrefs'j gqrxzz cef qzwivjmqhygiu xw xybmtèvr. hrzqf avpt, ma lzw jqef, bni psuijtuvskvf prqmpjzl zlr qzwivjmqhygmfr ja ivgort xyeb jynbuvl lrh "qidjzkh glzw qofjzzeax tsvvhdjaxvse evf yiazinh eeugt v zkkeijwqxu vvj iyidivvqmg imclvv nqh cqs [zvkvrèzg] jcwaku lv lif djbnmak ks lq mdbn mg".[6]
xyi dkwzvèxi pmglmt wvqtiq e iixwjvbosa jfv jgyio kbpigxqqdvtrc fxisvi. djbkh nyklwt qil seglvqivyxqgr plrvtgi gczavhxi lqtbaur (yinma eqmzupy) grptgt opk zvkvrèzg sdxnie yefzgqfihpr me lqu 1868 fdmii "glv etrxvjkx pmglmt" yi i ilvpuvmp'i himemmei. qp 1917, ixqkrgmwmk cczzognr uiaehdjkh glv zqiuièzk gvtyiz ci "duvsfwzftg ea bxeawcebkei".[7][8] bneg vvtcvqoqur jej rwv tzakviiu. gpchgmy fnfseog yn stsjr ks pclz jxsxie e dchditx bj klm eykpkv nw vezno va 1854 hyg jrmtgt ow vyopzwp jyn euvx.[9] orwquad mtxvvvpg dhjsk xui tmxjum ith cyspquxzl zlr xvgppylck ma xyi 19bj szvzyec, syb glzv keepziz, uehm yovpcil ehtxzeaeccavi xwapq stgiuyjvgpyc svmca opk gvtyiz kd opk 16xu gvrbwht.[6]
kxccxfkzcfcqi wymui zwbz cyiq ej e kcbxcregmfr ikt wg zlr wnmau qmue frxnimp 1914 qil 1940.
zlr zzkmpèhz kotuii ma uyhxri rrfyoj jj jk e smvpl eykpkv vj zx qu knmj ma gfrrwdxbosa azxp eykpkv qmjoa.[10] vxz kursiuizcjz azegij sn cczzogn, jfv mzqhxri, hwvh i dhvay gvtyiz fyns zs vqgpmouib zlr zzkmpèhz kotuii hctyio zlr edizksvv imimc ait. jcm isajvhmtqxg'y qrwjeogi rmxi sei jzqc nmivrx, rrl vxz ctmbr iiowbvzrc pvrgsgt dby qrwjeogi. opxshkyscv jcm cee, xyi kqdamjieeki tgqymxwumg tzkcvzopl vvpqgt pxur gliim mut xnvnwvw: "ucdxpkwgii ftwva", "kuqcpvxm xyxbuvl" eeh, iu jcm cee grqm ve v krsfi, "tsug hzbxmoykmwp".[11]
wdthiex mizpqh bxmrh ks zgfvqx xui svwmui kotuii (gzgqoqtk glv zmtdvu–bmtieèvm eykpkv vr 1918), syb pe hizxrv nliv xz loh, glv gqrxzz cef wkmtn lpttieespm ve xzetgeeetaida. bierrq'a yems, nsjimiz, glzvzynpcc tgt ow zlr sei-bkcz xgh, n xyiwtuoqieypp-yvdhziqeopv gqrxzz.[12]
jifgimxvyjv
zlr zzkmpèhz awynvv sz xybmtèvr xrftg, qgau oasnr iu jcm zeoyce zgsoi, iea fv yagt awx iagicxvyjv grq hvgzafoqur.
vr r gigivz imclvv, mcsc tkxgii sn vxz irtuesib ki npojgiu etqdb auqr rlqjgh jn vpngvw. nqh zfgqcpv, mv c svmyee gztpgh jn ylvjk 3, e eqkgl hipsdi l, d mjcrh oitsug u, t euyyh sikqcz j grq wf sv. vxz dokrrèii kkfcmx lnw jidghvt ierwrv kkfcmxw vr jiywuikk avxy hqhvzzkrg wymnv lvtaif.
xf ivehtxz, e gespm qv vtvlnfvxa eqi jk yfiu, xmtczl g xnflpi tuxbg, zvkvrèzg ilcgvr si zqiuièzk xnfci. qv xva zlr ectpcrzb cvvxkiv qko 26 boqrw zr lkvamxiax iseu, uvkn eytyejgj npojgiu ggebdkgpyc ks bju gmlx psdtituy bu xui gvmxyjcy eytyejgj, xwxvrwgsvfyio zs glv 26 twuidjri pevwit sdxniew. rx lkvamxiax gsqpjn qt xui vrktokbosa tiskgin, bni pmglmt knmy e qmwjmtuib gpclrfmv vmws sai fj bju mwcw. glv etrxvjkx hwvh iv uvkn tbmex lgfzvjw br r vmruvbort ovceqhy.[koxnxzsv puzlkh]
ssi ifccktk, whtgsag jciz xui gpikdomdx gs si mpsmgvxrh zw
ivjvkqeghrav.
vxz xkvfse wmptdvm xui diauqbm ilbsjia c azgcseh rrl tukmgxf mk yvvyg qz qnxtlmu jcm riakkl wh jcm vpnmexmzj, awx ikedttg, jcm qilafvl "nuhwt":
prqfrtgcjvri
retl zqm nbgvgw nmbj q fme prxkiz. vxz zkwg sw xpg hje nsyhj xpg bzbziew r xw b (yi anmsxvh wttzz). gpglfyoj jcmxi nvv 26 oma hjey wusnr, i eeym cmyp lwm qdgg gw zeec sgon (lojsiiivv qgxneoikw) iu jcmxi nvv yvkgpm rigxvva kd opk orc jxzkdb, pkvr nlwb 5 muta: {r, i, z, s, e}. jtcw, '{' vvj 'zvkvrmtudabiecveaaxpp' grq '}' jfv awsxmywvzv pmvjzzy ss xyi uginimi, fytgmuiddk prxkizu ea bni xip wbtyio cmyp si bcazv grq irgp ounagkr pvxbgh zvimclvvmf rt cymak zxa eemzkwcsehqpw fme vba. klm pusb rigxvv wh jcm qil mj gpqizv, grq xyeb ter qy kbrv etqdb bu jvru xpg sjtaqa lvelkdb bneg qrxkjun bni zijwiiu xpgvngkiz. vxz tkxgii eb vxz qtxrvjikvyjv uj [xip-vwy, cno-isy] mj xpg uikotuiiil nuobkv.
ssi ifccktk, xui wmzuj gmzxrv fj bju ktgmaxvbb, c, yn xgmeiu aqvx g, bni smiwb nuobkv bj klm mut. bnieiwszg, hje r eah tstwci i uj glv zqiuièzk wdyrvm chz cyiq, rrqmno g. aoqvprvta, vjz zlr wvgwpt gmzxrv fj bju ktgmaxvbb, vxz akgbru pmvjzz uj glv oma yn cyiq. xyi tgjomx eg vfa m cdy kuphqe x qu n. opk vrwk sn vxz xrevrkifv yn mtgvtyizgt dv g wvqzpit vvanmbr:
gpikdomdx: nxkekmqolgaa
ovc: tgcjvrizsepm
eykpkvgiox: tzvjxbisvelz
fuxzetgmfr qu fzzlseqvh ja wjqtk gs klm ter qt xui kejnu xwxvrwgsvfyio zs glv oma, vdvjmak klm renqzmbr fj bju xqvlrvkifv bzbzie me xpcj mwc eah klmp knqtk glv gwnkhv'y pnfvp iu jcm vpnmexmzj. awx ikedttg, yi zua y (jisu nuhwt), xui tmxjumbkbg p rtxgqma or pscyup q, rpogu mj xpg vdzyx cprmvvusb rigxvv. vgno, zua r (jisu nuhwt) mf kfrm ve, opk gvtyizvusb d mf pfgivuy bneg mj jwwdy qt gbplqv v. jccy x vw klm uuxwth cprmvvusb rigxvv.
可以直接在线爆破(https://www.guballa.de/vigenere-solver)一下
解得:
the quick brown fox jumps over 13 lazy dogs. history
the first well-documented description of a polyalphabetic cipher was formulated by leon battista alberti around 1467 and used a metal cipher disc to switch between cipher alphabets. alberti's system only switched alphabets after several words, and switches were indicated by writing the letter of the corresponding alphabet in the ciphertext. later, in 1508, johannes trithemius, in his work poligraphia, invented the tabula recta, a critical component of the vigenère cipher. the trithemius cipher, however, only provided a progressive, rigid and predictable system for switching between cipher alphabets.[citation needed]
what is now known as the vigenère cipher was originally described by giovan battista bellaso in his 1553 book la cifra del sig. giovan battista bellaso.[4] he built upon the tabula recta of trithemius but added a repeating "countersign" (a key) to switch cipher alphabets every letter. whereas alberti and trithemius used a fixed pattern of substitutions, bellaso's scheme meant the pattern of substitutions could be easily changed, simply by selecting a new key. keys were typically single words or short phrases, known to both parties in advance, or transmitted "out of band" along with the message. bellaso's method thus required strong security for only the key. as it is relatively easy to secure a short key phrase, such as by a previous private conversation, bellaso's system was considerably more secure.[citation needed]
blaise de vigenère published his description of a similar but stronger autokey cipher before the court of henry iii of france, in 1586.[5] later, in the 19th century, the invention of bellaso's cipher was misattributed to vigenère. david kahn, in his book, the codebreakers lamented the misattribution by saying that history had "ignored this important contribution and instead named a regressive and elementary cipher for him [vigenère] though he had nothing to do with it".[6]
the vigenère cipher gained a reputation for being exceptionally strong. noted author and mathematician charles lutwidge dodgson (lewis carroll) called the vigenère cipher unbreakable in his 1868 piece "the alphabet cipher" in a children's magazine. in 1917, scientific american described the vigenère cipher as "impossible of translation".[7][8] that reputation was not deserved. charles babbage is known to have broken a variant of the cipher as early as 1854 but failed to publish his work.[9] kasiski entirely broke the cipher and published the technique in the 19th century, but even earlier, some skilled cryptanalysts could occasionally break the cipher in the 16th century.[6]
cryptographic slide rule used as a calculation aid by the swiss army between 1914 and 1940.
the vigenère cipher is simple enough to be a field cipher if it is used in conjunction with cipher disks.[10] the confederate states of america, for example, used a brass cipher disk to implement the vigenère cipher during the american civil war. the confederacy's messages were far from secret, and the union regularly cracked its messages. throughout the war, the confederate leadership primarily relied upon three key phrases: "manchester bluff", "complete victory" and, as the war came to a close, "come retribution".[11]
gilbert vernam tried to repair the broken cipher (creating the vernam–vigenère cipher in 1918), but no matter what he did, the cipher was still vulnerable to cryptanalysis. vernam's work, however, eventually led to the one-time pad, a theoretically-unbreakable cipher.[12]
description
the vigenère square or vigenère table, also known as the tabula recta, can be used for encryption and decryption.
in a caesar cipher, each letter of the alphabet is shifted along some number of places. for example, in a caesar cipher of shift 3, a would become d, b would become e, y would become b and so on. the vigenère cipher has several caesar ciphers in sequence with different shift values.
to encrypt, a table of alphabets can be used, termed a tabula recta, vigenère square or vigenère table. it has the alphabet written out 26 times in different rows, each alphabet shifted cyclically to the left compared to the previous alphabet, corresponding to the 26 possible caesar ciphers. at different points in the encryption process, the cipher uses a different alphabet from one of the rows. the alphabet used at each point depends on a repeating keyword.[citation needed]
for example, suppose that the plaintext to be encrypted is
attackatdawn.
the person sending the message chooses a keyword and repeats it until it matches the length of the plaintext, for example, the keyword "lemon":
lemonlemonle
each row starts with a key letter. the rest of the row holds the letters a to z (in shifted order). although there are 26 key rows shown, a code will use only as many keys (different alphabets) as there are unique letters in the key string, here just 5 keys: {l, e, m, o, n}. flag, '{' and 'vigenereisveryeasyhuh' and '}' for successive letters of the message, successive letters of the key string will be taken and each message letter enciphered by using its corresponding key row. the next letter of the key is chosen, and that row is gone along to find the column heading that matches the message character. the letter at the intersection of [key-row, msg-col] is the enciphered letter.
for example, the first letter of the plaintext, a, is paired with l, the first letter of the key. therefore, row l and column a of the vigenère square are used, namely l. similarly, for the second letter of the plaintext, the second letter of the key is used. the letter at row e and column t is x. the rest of the plaintext is enciphered in a similar fashion:
plaintext: attackatdawn
key: lemonlemonle
ciphertext: lxfopvefrnhr
decryption is performed by going to the row in the table corresponding to the key, finding the position of the ciphertext letter in that row and then using the column's label as the plaintext. for example, in row l (from lemon), the ciphertext l appears in column a, which is the first plaintext letter. next, row e (from lemon) is gone to, the ciphertext x is located that is found in column t. thus t is the second plaintext letter.
菜菜直接百度翻译
敏捷的棕色狐狸跳过13只懒狗。历史
利昂·巴蒂斯塔·阿尔贝蒂(leon battista alberti)于1467年左右提出了关于多字母密码的第一个有文献记载的描述,并使用金属密码盘在密码字母之间切换。阿尔贝蒂的系统只在几个单词后切换字母表,而切换是通过在密文中写入相应字母表的字母来表示的。后来,在1508年,约翰内斯·特里希米斯在他的著作《poligraphia》中发明了直板密码,这是维格纳密码的一个重要组成部分。然而,trithemius密码只为密码字母之间的切换提供了一个渐进的、严格的和可预测的系统
现在被称为维格纳密码的东西最初是由乔万·巴蒂斯塔·贝拉索在其1553年的著作《锡金》(la cifra del sig)中描述的。giovan battista bellaso。[4]他以trithemius的直板为基础,但添加了一个重复的“会签”(一个键)来切换每个字母的密码字母表。阿尔贝蒂和特里希米斯使用固定的替换模式,而贝拉索的方案意味着替换模式可以很容易地改变,只需选择一个新的密钥。密钥通常是单字或短短语,双方事先都知道,或随消息一起“带外”传输。因此,bellaso的方法只要求密钥具有强大的安全性。由于很容易获得一个简短的关键短语,比如通过之前的私人对话,bellaso的系统就相当安全了
1586年,blaise de vigenère在法国亨利三世(henry iii of france)法庭上发表了他对类似但更强的自动密钥密码的描述。[5]后来,在19世纪,贝拉索密码的发明被错误地归因于vigenère。大卫·卡恩(david kahn)在他的书中,密码破译者对错误的归属表示哀叹,他们说历史“忽略了这一重要贡献,反而为他命名了一个回归的基本密码[vigenère],尽管他与此无关。”
维格纳密码以其异常强大而闻名。著名作家兼数学家查尔斯·卢特威奇·多奇森(刘易斯·卡罗尔饰)在其1868年的作品《字母密码》(the alphabet cipher)中,在一本儿童杂志上称维格纳密码是牢不可破的。1917年,《科学美国人》将维格纳密码描述为“不可能翻译的”。[7][8]这个名声是不配的。众所周知,查尔斯·巴贝奇早在1854年就破解了密码的一种变体,但没有发表他的作品。[9]卡西斯基在19世纪完全破解了密码,并发表了这项技术,但更早些时候,一些熟练的密码分析师在16世纪偶尔会破解密码。[6]
1914年至1940年间,瑞士军队用作计算辅助的密码计算尺。
vigenère密码非常简单,如果与密码盘一起使用,就可以成为字段密码。[10]例如,在美国内战期间,美国南部邦联使用黄铜密码盘来实现vigenère密码。南部联盟的信息远非秘密,联盟定期破解其信息。在整个战争期间,南部邦联领导层主要依靠三个关键短语:“曼彻斯特虚张声势”、“完全胜利”以及战争结束时的“报应”
吉尔伯特·韦纳姆(gilbert vernam)试图修复损坏的密码(1918年创建了韦纳姆-维格纳密码),但不管他做了什么,密码仍然容易受到密码分析的影响。然而,弗南的工作最终导致了一次性密码,一种理论上牢不可破的密码
描述
vigenère正方形或vigenère表格,也称为直板,可用于加密和解密。
在凯撒密码中,字母表中的每个字母都会沿一定数量的位置移动。例如,在移位3的凯撒密码中,a变成d,b变成e,y变成b,依此类推。vigenère密码有几个按顺序排列的caesar密码,其移位值不同。
为了进行加密,可以使用一个字母表,称为直板、维根埃雷方格或维根埃雷表。它的字母表在不同的行中写了26次,每个字母表相对于之前的字母表循环向左移动,对应于26个可能的凯撒密码。在加密过程的不同点,密码使用的字母表与其中一行不同。每个点使用的字母表取决于重复的关键字。[需要引用]
例如,假设要加密的明文是
在黎明时攻击。
发送消息的人选择一个关键字并重复它,直到它与明文的长度相匹配,例如,关键字“lemon”:
lemonlemonle
每行以一个关键字母开头。行的其余部分保存字母a到z(按移位顺序)。虽然显示了26个键行,但代码将只使用与键字符串中唯一字母数量相同的键(不同字母),这里只有5个键:{l,e,m,o,n}。标记“{”和“vigenereisveryeasyhuh”和“}”对于消息的连续字母,将获取密钥字符串的连续字母,并使用其对应的密钥行对每个消息字母进行加密。选择键的下一个字母,并沿着该行查找与消息字符匹配的列标题。[key row,msg col]交叉处的字母为加密字母。
例如,明文的第一个字母a与密钥的第一个字母l配对。因此,使用了维格纳广场的l行和a列,即l。类似地,对于明文的第二个字母,使用密钥的第二个字母。e行和t列的字母是x。其余的明文以类似的方式进行加密:
明文:attackatdawn
关键字:lemonlemonle
密文:lxfopvefrnhr
解密是通过转到表中与密钥对应的行,找到该行中密文字母的位置,然后使用列的标签作为明文来执行的。例如,在l行(来自lemon),密文l出现在a列中,a列是第一个明文字母。接下来,行e(来自lemon)转到,密文x位于列t中。因此,t是第二个纯文本字母。
额,没找到
还是在英文里找道的:
flag, ‘{’ and ‘vigenereisveryeasyhuh’ and ‘}’
所以,flag为:
flag{vigenereisveryeasyhuh}
RSA_gcd
题目
n: 23220619839642624127208804329329079289273497927351564011985292026254914394833691542552890810511751239656361686073628273309390314881604580204429708461587512500636158161303419916259271078173864800267063540526943181173708108324471815782985626723198144643256432774984884880698594364583949485749575467318173034467846143380574145455195152793742611717169602237969286580028662721065495380192815175057945420182742366791661416822623915523868590710387635935179876275147056396018527260488459333051132720558953142984038635223793992651637708150494964785475065404568844039983381403909341302098773533325080910057845573898984314246089
e: 65537
c:9700614748413503291260966231863562117502096284616216707445276355274869086619796527618473213422509996843430296526594113572675840559345077344419098900818709577642324900405582499683604786981144099878021784567540654040833912063141709913653416394888766281465200682852378794478801329251224801006820925858507273130504236563822120838520746270280731121442839412258397191963036040553539697846535038841541209050503061001070909725806574230090246041891486506980939294245537252610944799573920844235221096956391095716111629998594075762507345430945523492775915790828078000453705320783486744734994213028476446922815870053311973844961
n: 22642739016943309717184794898017950186520467348317322177556419830195164079827782890660385734113396507640392461790899249329899658620250506845740531699023854206947331021605746078358967885852989786535093914459120629747240179425838485974008209140597947135295304382318570454491064938082423309363452665886141604328435366646426917928023608108470382196753292656828513681562077468846105122812084765257799070754405638149508107463233633350462138751758913036373169668828888213323429656344812014480962916088695910177763839393954730732312224100718431146133548897031060554005592930347226526561939922660855047026581292571487960929911
e: 65537
c:20513108670823938405207629835395350087127287494963553421797351726233221750526355985253069487753150978011340115173042210284965521215128799369083065796356395285905154260709263197195828765397189267866348946188652752076472172155755940282615212228370367042435203584159326078238921502151083768908742480756781277358357734545694917591921150127540286087770229112383605858821811640935475859936319249757754722093551370392083736485637225052738864742947137890363135709796410008845576985297696922681043649916650599349320818901512835007050425460872675857974069927846620905981374869166202896905600343223640296138423898703137236463508
解密代码
import gmpy2
from Crypto.Util.number import long_to_bytes
#插入数据
phi = (q-1) * (p-1)
d = gmpy2.invert(e,phi)
m = gmpy2.powmod(c,d,n)
print(long_to_bytes(m))
放入不同的数据得到
flag{336BB5172ADE227FE68BAA44FDA73F3B}