[{"data":1,"prerenderedAt":602},["ShallowReactive",2],{"navigation_docs":3,"-ciphers-porta":304,"-ciphers-porta-surround":597},[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":84,"body":306,"description":590,"extension":591,"links":592,"meta":593,"navigation":594,"path":85,"seo":595,"stem":86,"__hash__":596},"docs\u002F2.ciphers\u002F11.porta.md",{"type":307,"value":308,"toc":585},"minimark",[309,313,330,429,439,444,455,469,522,528,532,550,554,564,581],[310,311],"cipher-facts",{"name":312},"porta",[314,315,316,317,321,322,325,326,329],"p",{},"Giambattista della Porta printed this one in 1563. Each key letter picks one of 13 tables. A and B share the first, C and D the second, and so on up to Y and Z. Every table swaps the two halves of the alphabet. A to M goes to N to Z and back again. So ",[318,319,320],"code",{},"encode"," and ",[318,323,324],{},"decode"," are the same call, like ",[327,328,80],"a",{"href":81},".",[331,332,337],"pre",{"className":333,"code":334,"language":335,"meta":336,"style":336},"language-ts shiki shiki-themes ciphers ciphers ciphers","const porta = create(\"porta\");\nconst key = { key: \"FORTIFICATION\" };\nporta.encode(\"DEFENDTHEEASTWALLOFTHECASTLE\", key).text;\n\u002F\u002F \"SYNNJSCVRNRLAHUTUKUCVRYRLANY\"\nporta.encode(\"SYNNJSCVRN\", key).text; \u002F\u002F \"DEFENDTHEE\", same call back\n","ts","",[318,338,339,369,388,404,411],{"__ignoreMap":336},[340,341,344,348,352,355,359,362,366],"span",{"class":342,"line":343},"line",1,[340,345,347],{"class":346},"skH_V","const",[340,349,351],{"class":350},"s38Sx"," porta ",[340,353,354],{"class":346},"=",[340,356,358],{"class":357},"sK71F"," create",[340,360,361],{"class":350},"(",[340,363,365],{"class":364},"shU9J","\"porta\"",[340,367,368],{"class":350},");\n",[340,370,372,374,377,379,382,385],{"class":342,"line":371},2,[340,373,347],{"class":346},[340,375,376],{"class":350}," key ",[340,378,354],{"class":346},[340,380,381],{"class":350}," { key: ",[340,383,384],{"class":364},"\"FORTIFICATION\"",[340,386,387],{"class":350}," };\n",[340,389,391,394,396,398,401],{"class":342,"line":390},3,[340,392,393],{"class":350},"porta.",[340,395,320],{"class":357},[340,397,361],{"class":350},[340,399,400],{"class":364},"\"DEFENDTHEEASTWALLOFTHECASTLE\"",[340,402,403],{"class":350},", key).text;\n",[340,405,407],{"class":342,"line":406},4,[340,408,410],{"class":409},"scIB-","\u002F\u002F \"SYNNJSCVRNRLAHUTUKUCVRYRLANY\"\n",[340,412,414,416,418,420,423,426],{"class":342,"line":413},5,[340,415,393],{"class":350},[340,417,320],{"class":357},[340,419,361],{"class":350},[340,421,422],{"class":364},"\"SYNNJSCVRN\"",[340,424,425],{"class":350},", key).text; ",[340,427,428],{"class":409},"\u002F\u002F \"DEFENDTHEE\", same call back\n",[314,430,431,432,438],{},"That's the worked example from ",[327,433,437],{"href":434,"rel":435},"http:\u002F\u002Fpracticalcryptography.com\u002Fciphers\u002Fporta-cipher\u002F",[436],"nofollow","Practical Cryptography",", which uses the ACA table.",[440,441,443],"h2",{"id":442},"which-way-does-it-turn","Which way does it turn?",[314,445,446,447,450,451,454],{},"Here's the catch. Nobody agrees which way the N to Z half moves from table to table. The ACA, Gaines and Practical Cryptography turn it left, so C and D give ",[318,448,449],{},"OPQ…",". dCode turns it right by default, so C and D give ",[318,452,453],{},"ZNO…",". Same key, same text, two ciphertexts. Both stay reciprocal, so the wrong one doesn't fail. It just hands you noise.",[314,456,457,460,461,464,465,468],{},[318,458,459],{},"rotation"," picks the side, ",[318,462,463],{},"left"," by default or ",[318,466,467],{},"right",":",[331,470,472],{"className":333,"code":471,"language":335,"meta":336,"style":336},"porta.encode(\"DCODE\", { key: \"PORTA\", rotation: \"right\" }).text; \u002F\u002F \"WVJUR\", dCode's example\nporta.encode(\"DCODE\", { key: \"PORTA\" }).text; \u002F\u002F \"XWGZR\", the ACA table\n",[318,473,474,503],{"__ignoreMap":336},[340,475,476,478,480,482,485,488,491,494,497,500],{"class":342,"line":343},[340,477,393],{"class":350},[340,479,320],{"class":357},[340,481,361],{"class":350},[340,483,484],{"class":364},"\"DCODE\"",[340,486,487],{"class":350},", { key: ",[340,489,490],{"class":364},"\"PORTA\"",[340,492,493],{"class":350},", rotation: ",[340,495,496],{"class":364},"\"right\"",[340,498,499],{"class":350}," }).text; ",[340,501,502],{"class":409},"\u002F\u002F \"WVJUR\", dCode's example\n",[340,504,505,507,509,511,513,515,517,519],{"class":342,"line":371},[340,506,393],{"class":350},[340,508,320],{"class":357},[340,510,361],{"class":350},[340,512,484],{"class":364},[340,514,487],{"class":350},[340,516,490],{"class":364},[340,518,499],{"class":350},[340,520,521],{"class":409},"\u002F\u002F \"XWGZR\", the ACA table\n",[314,523,524,525,527],{},"Got a Porta from dCode that reads like soup? Flip ",[318,526,459],{}," before you blame the key.",[440,529,531],{"id":530},"the-rest-of-the-text","The rest of the text",[314,533,534,535,538,539,542,543,546,547,329],{},"Only ASCII letters move the key along. Spaces, punctuation and emoji pass through. Lowercase stays lowercase unless ",[318,536,537],{},"preserveCase"," is false, and ",[318,540,541],{},"stripNonAlpha"," drops everything outside A to Z first. The key ignores case and anything that isn't a letter. No key is a ",[318,544,545],{},"MissingOptionError",", and a key without letters an ",[318,548,549],{},"InvalidOptionError",[440,551,553],{"id":552},"why-its-weak","Why it's weak",[314,555,556,557,321,560,563],{},"Thirteen tables, not 26. F and E pick the same one, so ",[318,558,559],{},"FORT",[318,561,562],{},"EPQS"," are the same key. A key of n letters has 2^n spellings, and FORTIFICATION alone has 8,192.",[314,565,566,567,570,571,574,575,580],{},"Worse, a letter never stays in its half. E can't come out as H, so ",[318,568,569],{},"HEP"," is never ",[318,572,573],{},"THE",". That's a free filter for every crib you try. The key still repeats too, so ",[327,576,577],{"href":17},[318,578,579],{},"period"," finds its length the same way it does for Vigenère. Handy on paper, one table for both ways. That's about all it has going for it.",[582,583,584],"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":336,"searchDepth":371,"depth":371,"links":586},[587,588,589],{"id":442,"depth":371,"text":443},{"id":530,"depth":371,"text":531},{"id":552,"depth":371,"text":553},"Thirteen tables for 26 key letters. A to M always swaps with N to Z. One call encodes and decodes.","md",null,{},true,{"title":84,"description":590},"5fct_l0gt4sfbvxcX-Hu056Kcfh8Y4VCLT8dbS6JGvk",[598,600],{"title":80,"path":81,"stem":82,"description":599,"children":-1},"Subtract each letter from a repeating key. The same operation encodes and decodes.",{"title":88,"path":89,"stem":90,"description":601,"children":-1},"A primer starts the key, then the plaintext takes over.",1791461057822]