[{"data":1,"prerenderedAt":556},["ShallowReactive",2],{"navigation_docs":3,"-ciphers-running-key":304,"-ciphers-running-key-surround":551},[4,36],{"title":5,"path":6,"stem":7,"children":8,"icon":35},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Encode and decode","\u002Fguide\u002Ftransform","1.guide\u002F02.transform",{"title":16,"path":17,"stem":18},"Analysis","\u002Fguide\u002Fanalysis","1.guide\u002F03.analysis",{"title":20,"path":21,"stem":22},"CLI","\u002Fguide\u002Fcli","1.guide\u002F04.cli",{"title":24,"path":25,"stem":26},"Agents","\u002Fguide\u002Fagents","1.guide\u002F05.agents",{"title":28,"path":29,"stem":30},"Custom ciphers","\u002Fguide\u002Fcustom","1.guide\u002F06.custom",{"title":32,"path":33,"stem":34},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F07.playground","i-lucide-book-open",{"title":37,"path":38,"stem":39,"children":40,"icon":303},"Ciphers","\u002Fciphers","2.ciphers\u002F00.index",[41,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,259,263,267,271,275,279,283,287,291,295,299],{"title":42,"path":38,"stem":39},"Overview",{"title":44,"path":45,"stem":46},"Classical","\u002Fciphers\u002Fclassical","2.ciphers\u002F01.classical",{"title":48,"path":49,"stem":50},"Caesar","\u002Fciphers\u002Fcaesar","2.ciphers\u002F02.caesar",{"title":52,"path":53,"stem":54},"ROT-13","\u002Fciphers\u002Frot13","2.ciphers\u002F03.rot13",{"title":56,"path":57,"stem":58},"ROT-47","\u002Fciphers\u002Frot47","2.ciphers\u002F04.rot47",{"title":60,"path":61,"stem":62},"Atbash","\u002Fciphers\u002Fatbash","2.ciphers\u002F05.atbash",{"title":64,"path":65,"stem":66},"Affine","\u002Fciphers\u002Faffine","2.ciphers\u002F06.affine",{"title":68,"path":69,"stem":70},"Substitution","\u002Fciphers\u002Fsubstitution","2.ciphers\u002F07.substitution",{"title":72,"path":73,"stem":74},"Vigenère","\u002Fciphers\u002Fvigenere","2.ciphers\u002F08.vigenere",{"title":76,"path":77,"stem":78},"Gronsfeld","\u002Fciphers\u002Fgronsfeld","2.ciphers\u002F09.gronsfeld",{"title":80,"path":81,"stem":82},"Beaufort","\u002Fciphers\u002Fbeaufort","2.ciphers\u002F10.beaufort",{"title":84,"path":85,"stem":86},"Porta","\u002Fciphers\u002Fporta","2.ciphers\u002F11.porta",{"title":88,"path":89,"stem":90},"Autokey","\u002Fciphers\u002Fautokey","2.ciphers\u002F12.autokey",{"title":92,"path":93,"stem":94},"Running key","\u002Fciphers\u002Frunning-key","2.ciphers\u002F13.running-key",{"title":96,"path":97,"stem":98},"Trithemius","\u002Fciphers\u002Ftrithemius","2.ciphers\u002F14.trithemius",{"title":100,"path":101,"stem":102},"Alberti","\u002Fciphers\u002Falberti","2.ciphers\u002F15.alberti",{"title":104,"path":105,"stem":106},"Playfair","\u002Fciphers\u002Fplayfair","2.ciphers\u002F16.playfair",{"title":108,"path":109,"stem":110},"Four-square","\u002Fciphers\u002Ffour-square","2.ciphers\u002F17.four-square",{"title":112,"path":113,"stem":114},"Hill","\u002Fciphers\u002Fhill","2.ciphers\u002F18.hill",{"title":116,"path":117,"stem":118},"Polybius square","\u002Fciphers\u002Fpolybius","2.ciphers\u002F19.polybius",{"title":120,"path":121,"stem":122},"Nihilist","\u002Fciphers\u002Fnihilist","2.ciphers\u002F20.nihilist",{"title":124,"path":125,"stem":126},"Morse code","\u002Fciphers\u002Fmorse","2.ciphers\u002F21.morse",{"title":128,"path":129,"stem":130},"Bacon's cipher","\u002Fciphers\u002Fbacon","2.ciphers\u002F22.bacon",{"title":132,"path":133,"stem":134},"Tap code","\u002Fciphers\u002Ftap-code","2.ciphers\u002F23.tap-code",{"title":136,"path":137,"stem":138},"A1Z26","\u002Fciphers\u002Fa1z26","2.ciphers\u002F24.a1z26",{"title":140,"path":141,"stem":142},"Book cipher","\u002Fciphers\u002Fbook","2.ciphers\u002F25.book",{"title":144,"path":145,"stem":146},"ADFGVX","\u002Fciphers\u002Fadfgvx","2.ciphers\u002F26.adfgvx",{"title":148,"path":149,"stem":150},"Bifid","\u002Fciphers\u002Fbifid","2.ciphers\u002F27.bifid",{"title":152,"path":153,"stem":154},"Straddling checkerboard","\u002Fciphers\u002Fstraddling-checkerboard","2.ciphers\u002F28.straddling-checkerboard",{"title":156,"path":157,"stem":158},"Rail fence","\u002Fciphers\u002Frail-fence","2.ciphers\u002F29.rail-fence",{"title":160,"path":161,"stem":162},"Columnar transposition","\u002Fciphers\u002Fcolumnar","2.ciphers\u002F30.columnar",{"title":164,"path":165,"stem":166},"Route transposition","\u002Fciphers\u002Froute","2.ciphers\u002F31.route",{"title":168,"path":169,"stem":170},"Enigma M3","\u002Fciphers\u002Fenigma","2.ciphers\u002F32.enigma",{"title":172,"path":173,"stem":174},"Block","\u002Fciphers\u002Fblock","2.ciphers\u002F33.block",{"title":176,"path":177,"stem":178},"AES (ECB)","\u002Fciphers\u002Faes","2.ciphers\u002F34.aes",{"title":180,"path":181,"stem":182},"AES (CBC)","\u002Fciphers\u002Faes-cbc","2.ciphers\u002F35.aes-cbc",{"title":184,"path":185,"stem":186},"AES (CFB)","\u002Fciphers\u002Faes-cfb","2.ciphers\u002F36.aes-cfb",{"title":188,"path":189,"stem":190},"AES (OFB)","\u002Fciphers\u002Faes-ofb","2.ciphers\u002F37.aes-ofb",{"title":192,"path":193,"stem":194},"AES (CTR)","\u002Fciphers\u002Faes-ctr","2.ciphers\u002F38.aes-ctr",{"title":196,"path":197,"stem":198},"AES (CCM)","\u002Fciphers\u002Faes-ccm","2.ciphers\u002F39.aes-ccm",{"title":200,"path":201,"stem":202},"AES (OCB)","\u002Fciphers\u002Faes-ocb","2.ciphers\u002F40.aes-ocb",{"title":204,"path":205,"stem":206},"AES (LRW)","\u002Fciphers\u002Faes-lrw","2.ciphers\u002F41.aes-lrw",{"title":208,"path":209,"stem":210},"AES (XTS)","\u002Fciphers\u002Faes-xts","2.ciphers\u002F42.aes-xts",{"title":212,"path":213,"stem":214},"AES (CBC-MAC)","\u002Fciphers\u002Faes-cbc-mac","2.ciphers\u002F43.aes-cbc-mac",{"title":216,"path":217,"stem":218},"AES (passphrase)","\u002Fciphers\u002Faes-passphrase","2.ciphers\u002F44.aes-passphrase",{"title":220,"path":221,"stem":222},"Rijndael (ECB)","\u002Fciphers\u002Frijndael","2.ciphers\u002F45.rijndael",{"title":224,"path":225,"stem":226},"DES (ECB)","\u002Fciphers\u002Fdes","2.ciphers\u002F46.des",{"title":228,"path":229,"stem":230},"DESX (ECB)","\u002Fciphers\u002Fdesx","2.ciphers\u002F47.desx",{"title":232,"path":233,"stem":234},"Triple DES (ECB)","\u002Fciphers\u002Ftriple-des","2.ciphers\u002F48.triple-des",{"title":236,"path":237,"stem":238},"Triple DES (CBC)","\u002Fciphers\u002Ftriple-des-cbc","2.ciphers\u002F49.triple-des-cbc",{"title":240,"path":241,"stem":242},"Blowfish (ECB)","\u002Fciphers\u002Fblowfish","2.ciphers\u002F50.blowfish",{"title":244,"path":245,"stem":246},"IDEA (ECB)","\u002Fciphers\u002Fidea","2.ciphers\u002F51.idea",{"title":248,"path":249,"stem":250},"Lucifer (ECB)","\u002Fciphers\u002Flucifer","2.ciphers\u002F52.lucifer",{"title":252,"path":253,"stem":254},"MARS (ECB)","\u002Fciphers\u002Fmars","2.ciphers\u002F53.mars",{"title":256,"path":257,"stem":258},"Serpent (ECB)","\u002Fciphers\u002Fserpent","2.ciphers\u002F54.serpent",{"title":260,"path":261,"stem":262},"CAST5 (ECB)","\u002Fciphers\u002Fcast5","2.ciphers\u002F55.cast5",{"title":264,"path":265,"stem":266},"OpenPGP (passphrase)","\u002Fciphers\u002Fopenpgp","2.ciphers\u002F56.openpgp",{"title":268,"path":269,"stem":270},"Stream","\u002Fciphers\u002Fstream","2.ciphers\u002F57.stream",{"title":272,"path":273,"stem":274},"Rabbit","\u002Fciphers\u002Frabbit","2.ciphers\u002F58.rabbit",{"title":276,"path":277,"stem":278},"RC4","\u002Fciphers\u002Frc4","2.ciphers\u002F59.rc4",{"title":280,"path":281,"stem":282},"XOR","\u002Fciphers\u002Fxor","2.ciphers\u002F60.xor",{"title":284,"path":285,"stem":286},"Salsa20","\u002Fciphers\u002Fsalsa20","2.ciphers\u002F61.salsa20",{"title":288,"path":289,"stem":290},"XSalsa20","\u002Fciphers\u002Fxsalsa20","2.ciphers\u002F62.xsalsa20",{"title":292,"path":293,"stem":294},"ChaCha20","\u002Fciphers\u002Fchacha20","2.ciphers\u002F63.chacha20",{"title":296,"path":297,"stem":298},"XChaCha20","\u002Fciphers\u002Fxchacha20","2.ciphers\u002F64.xchacha20",{"title":300,"path":301,"stem":302},"ChaCha20-Poly1305","\u002Fciphers\u002Fchacha20-poly1305","2.ciphers\u002F65.chacha20-poly1305","i-lucide-library",{"id":305,"title":92,"body":306,"description":544,"extension":545,"links":546,"meta":547,"navigation":548,"path":93,"seo":549,"stem":94,"__hash__":550},"docs\u002F2.ciphers\u002F13.running-key.md",{"type":307,"value":308,"toc":539},"minimark",[309,313,317,412,428,433,440,450,468,472,482,504,511,515,532,535],[310,311],"cipher-facts",{"name":312},"running-key",[314,315,316],"p",{},"Vigenère's weak spot is the keyword going round and round. Running key fixes it the lazy way. The key is as long as the message. Nobody remembers two hundred random letters. But everybody owns a book. Pick a page, pick a line, and the text from there on is the key.",[318,319,324],"pre",{"className":320,"code":321,"language":322,"meta":323,"style":323},"language-ts shiki shiki-themes ciphers ciphers ciphers","const runningKey = create(\"running-key\");\nconst page63 = \"errors can occur in several places. A label has...\";\nrunningKey.encode(\"Flee at once. We are discovered\", { key: page63 }).text; \u002F\u002F \"Jcvs rl qnps. Yg uim qawxsmecto\"\nrunningKey.decode(\"JCVSRLQNPSYGUIMQAWXSMECTO\", { key: page63 }).text; \u002F\u002F \"FLEEATONCEWEAREDISCOVERED\"\n","ts","",[325,326,327,357,373,394],"code",{"__ignoreMap":323},[328,329,332,336,340,343,347,350,354],"span",{"class":330,"line":331},"line",1,[328,333,335],{"class":334},"skH_V","const",[328,337,339],{"class":338},"s38Sx"," runningKey ",[328,341,342],{"class":334},"=",[328,344,346],{"class":345},"sK71F"," create",[328,348,349],{"class":338},"(",[328,351,353],{"class":352},"shU9J","\"running-key\"",[328,355,356],{"class":338},");\n",[328,358,360,362,365,367,370],{"class":330,"line":359},2,[328,361,335],{"class":334},[328,363,364],{"class":338}," page63 ",[328,366,342],{"class":334},[328,368,369],{"class":352}," \"errors can occur in several places. A label has...\"",[328,371,372],{"class":338},";\n",[328,374,376,379,382,384,387,390],{"class":330,"line":375},3,[328,377,378],{"class":338},"runningKey.",[328,380,381],{"class":345},"encode",[328,383,349],{"class":338},[328,385,386],{"class":352},"\"Flee at once. We are discovered\"",[328,388,389],{"class":338},", { key: page63 }).text; ",[328,391,393],{"class":392},"scIB-","\u002F\u002F \"Jcvs rl qnps. Yg uim qawxsmecto\"\n",[328,395,397,399,402,404,407,409],{"class":330,"line":396},4,[328,398,378],{"class":338},[328,400,401],{"class":345},"decode",[328,403,349],{"class":338},[328,405,406],{"class":352},"\"JCVSRLQNPSYGUIMQAWXSMECTO\"",[328,408,389],{"class":338},[328,410,411],{"class":392},"\u002F\u002F \"FLEEATONCEWEAREDISCOVERED\"\n",[314,413,414,415,422,423,427],{},"That's the ",[416,417,421],"a",{"href":418,"rel":419},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRunning_key_cipher#Example",[420],"nofollow","example on Wikipedia",". The key is page 63, line 1 of ",[424,425,426],"em",{},"The C Programming Language",". A cipher keyed by K&R. Hard to pick a better book.",[429,430,432],"h2",{"id":431},"how-long-does-the-key-have-to-be","How long does the key have to be?",[314,434,435,436,439],{},"One letter per letter of the text, at least. Only ASCII letters count, on both sides. The spaces and the ",[325,437,438],{},"..."," in the K&R line cost nothing. Neither does the punctuation in the message. Letters past the end stay unused, so pass the whole page if you like.",[314,441,442,443,446,447,449],{},"A key that runs out first is an ",[325,444,445],{},"InvalidOptionError"," with both counts. Why not just wrap around? Because a running key that wraps is plain ",[416,448,72],{"href":73}," with a long keyword. Handing that back without a word would be a lie.",[314,451,452,453,456,457,459,460,463,464,467],{},"No key is a ",[325,454,455],{},"MissingOptionError",". A key without a single letter is an ",[325,458,445],{},". ",[325,461,462],{},"preserveCase"," and ",[325,465,466],{},"stripNonAlpha"," work as in Vigenère.",[429,469,471],{"id":470},"where-does-the-next-message-start","Where does the next message start?",[314,473,474,477,478,481],{},[325,475,476],{},"result.options"," doesn't echo the passage back. A page of a book in every result wastes everyone's screen. It carries ",[325,479,480],{},"keyUsed"," instead, the key letters this message took:",[318,483,485],{"className":320,"code":484,"language":322,"meta":323,"style":323},"runningKey.encode(\"Flee at once\", { key: page63 }).options; \u002F\u002F { keyUsed: 10, preserveCase: true, stripNonAlpha: false }\n",[325,486,487],{"__ignoreMap":323},[328,488,489,491,493,495,498,501],{"class":330,"line":331},[328,490,378],{"class":338},[328,492,381],{"class":345},[328,494,349],{"class":338},[328,496,497],{"class":352},"\"Flee at once\"",[328,499,500],{"class":338},", { key: page63 }).options; ",[328,502,503],{"class":392},"\u002F\u002F { keyUsed: 10, preserveCase: true, stripNonAlpha: false }\n",[314,505,506,507,510],{},"The next message picks up the page from letter eleven. The ",[416,508,509],{"href":25},"agent tools"," take a key of up to 1,000 characters. A whole chapter stays a library call.",[429,512,514],{"id":513},"is-it-unbreakable","Is it unbreakable?",[314,516,517,518,523,524,527,528,531],{},"No. Better than Vigenère, though. ",[416,519,520],{"href":17},[325,521,522],{},"period"," still ranks key lengths, but none of them lifts the columns to English. Take a Dickens paragraph keyed with the opening of Moby-Dick. The best length scores an IC of 0.052. LEMON on the same text hits 0.079 at length 5. ",[325,525,526],{},"guess"," sees several alphabets and lists running key with the other polyalphabetic ciphers. ",[325,529,530],{},"recover"," has no running key mode, its search wants a key that repeats.",[314,533,534],{},"The catch is that the key is English too. Guess a likely word in the message and take it off. Does what's left read like a book? Then you have a piece of both. That's roughly how Bazeries read the dispatches of the Duke of Orléans's conspirators in 1899. Pick a random page all you like. It's still prose.",[536,537,538],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":323,"searchDepth":359,"depth":359,"links":540},[541,542,543],{"id":431,"depth":359,"text":432},{"id":470,"depth":359,"text":471},{"id":513,"depth":359,"text":514},"Vigenère with a page of a book for a key. The key is as long as the message and never comes round again, so there's no period to find.","md",null,{},true,{"title":92,"description":544},"LmSPkV9Accf3XKNmHdhE8LVQm_qu_PcsEKGettZBjTM",[552,554],{"title":88,"path":89,"stem":90,"description":553,"children":-1},"A primer starts the key, then the plaintext takes over.",{"title":96,"path":97,"stem":98,"description":555,"children":-1},"A progressive shift. 0 for the first letter, 1 for the second, 2 for the third. No key, one fixed mapping.",1791461058041]