[{"data":1,"prerenderedAt":538},["ShallowReactive",2],{"navigation_docs":3,"-ciphers-hill":288,"-ciphers-hill-surround":533},[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":287},"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],{"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},"Beaufort","\u002Fciphers\u002Fbeaufort","2.ciphers\u002F09.beaufort",{"title":80,"path":81,"stem":82},"Autokey","\u002Fciphers\u002Fautokey","2.ciphers\u002F10.autokey",{"title":84,"path":85,"stem":86},"Trithemius","\u002Fciphers\u002Ftrithemius","2.ciphers\u002F11.trithemius",{"title":88,"path":89,"stem":90},"Alberti","\u002Fciphers\u002Falberti","2.ciphers\u002F12.alberti",{"title":92,"path":93,"stem":94},"Playfair","\u002Fciphers\u002Fplayfair","2.ciphers\u002F13.playfair",{"title":96,"path":97,"stem":98},"Hill","\u002Fciphers\u002Fhill","2.ciphers\u002F14.hill",{"title":100,"path":101,"stem":102},"Polybius square","\u002Fciphers\u002Fpolybius","2.ciphers\u002F15.polybius",{"title":104,"path":105,"stem":106},"Nihilist","\u002Fciphers\u002Fnihilist","2.ciphers\u002F16.nihilist",{"title":108,"path":109,"stem":110},"Morse code","\u002Fciphers\u002Fmorse","2.ciphers\u002F17.morse",{"title":112,"path":113,"stem":114},"Bacon's cipher","\u002Fciphers\u002Fbacon","2.ciphers\u002F18.bacon",{"title":116,"path":117,"stem":118},"Tap code","\u002Fciphers\u002Ftap-code","2.ciphers\u002F19.tap-code",{"title":120,"path":121,"stem":122},"A1Z26","\u002Fciphers\u002Fa1z26","2.ciphers\u002F20.a1z26",{"title":124,"path":125,"stem":126},"Book cipher","\u002Fciphers\u002Fbook","2.ciphers\u002F21.book",{"title":128,"path":129,"stem":130},"ADFGVX","\u002Fciphers\u002Fadfgvx","2.ciphers\u002F22.adfgvx",{"title":132,"path":133,"stem":134},"Bifid","\u002Fciphers\u002Fbifid","2.ciphers\u002F23.bifid",{"title":136,"path":137,"stem":138},"Straddling checkerboard","\u002Fciphers\u002Fstraddling-checkerboard","2.ciphers\u002F24.straddling-checkerboard",{"title":140,"path":141,"stem":142},"Rail fence","\u002Fciphers\u002Frail-fence","2.ciphers\u002F25.rail-fence",{"title":144,"path":145,"stem":146},"Columnar transposition","\u002Fciphers\u002Fcolumnar","2.ciphers\u002F26.columnar",{"title":148,"path":149,"stem":150},"Route transposition","\u002Fciphers\u002Froute","2.ciphers\u002F27.route",{"title":152,"path":153,"stem":154},"Enigma M3","\u002Fciphers\u002Fenigma","2.ciphers\u002F28.enigma",{"title":156,"path":157,"stem":158},"Block","\u002Fciphers\u002Fblock","2.ciphers\u002F29.block",{"title":160,"path":161,"stem":162},"AES (ECB)","\u002Fciphers\u002Faes","2.ciphers\u002F30.aes",{"title":164,"path":165,"stem":166},"AES (CBC)","\u002Fciphers\u002Faes-cbc","2.ciphers\u002F31.aes-cbc",{"title":168,"path":169,"stem":170},"AES (CFB)","\u002Fciphers\u002Faes-cfb","2.ciphers\u002F32.aes-cfb",{"title":172,"path":173,"stem":174},"AES (OFB)","\u002Fciphers\u002Faes-ofb","2.ciphers\u002F33.aes-ofb",{"title":176,"path":177,"stem":178},"AES (CTR)","\u002Fciphers\u002Faes-ctr","2.ciphers\u002F34.aes-ctr",{"title":180,"path":181,"stem":182},"AES (CCM)","\u002Fciphers\u002Faes-ccm","2.ciphers\u002F35.aes-ccm",{"title":184,"path":185,"stem":186},"AES (OCB)","\u002Fciphers\u002Faes-ocb","2.ciphers\u002F36.aes-ocb",{"title":188,"path":189,"stem":190},"AES (LRW)","\u002Fciphers\u002Faes-lrw","2.ciphers\u002F37.aes-lrw",{"title":192,"path":193,"stem":194},"AES (XTS)","\u002Fciphers\u002Faes-xts","2.ciphers\u002F38.aes-xts",{"title":196,"path":197,"stem":198},"AES (CBC-MAC)","\u002Fciphers\u002Faes-cbc-mac","2.ciphers\u002F39.aes-cbc-mac",{"title":200,"path":201,"stem":202},"AES (passphrase)","\u002Fciphers\u002Faes-passphrase","2.ciphers\u002F40.aes-passphrase",{"title":204,"path":205,"stem":206},"Rijndael (ECB)","\u002Fciphers\u002Frijndael","2.ciphers\u002F41.rijndael",{"title":208,"path":209,"stem":210},"DES (ECB)","\u002Fciphers\u002Fdes","2.ciphers\u002F42.des",{"title":212,"path":213,"stem":214},"DESX (ECB)","\u002Fciphers\u002Fdesx","2.ciphers\u002F43.desx",{"title":216,"path":217,"stem":218},"Triple DES (ECB)","\u002Fciphers\u002Ftriple-des","2.ciphers\u002F44.triple-des",{"title":220,"path":221,"stem":222},"Triple DES (CBC)","\u002Fciphers\u002Ftriple-des-cbc","2.ciphers\u002F45.triple-des-cbc",{"title":224,"path":225,"stem":226},"Blowfish (ECB)","\u002Fciphers\u002Fblowfish","2.ciphers\u002F46.blowfish",{"title":228,"path":229,"stem":230},"IDEA (ECB)","\u002Fciphers\u002Fidea","2.ciphers\u002F47.idea",{"title":232,"path":233,"stem":234},"Lucifer (ECB)","\u002Fciphers\u002Flucifer","2.ciphers\u002F48.lucifer",{"title":236,"path":237,"stem":238},"MARS (ECB)","\u002Fciphers\u002Fmars","2.ciphers\u002F49.mars",{"title":240,"path":241,"stem":242},"Serpent (ECB)","\u002Fciphers\u002Fserpent","2.ciphers\u002F50.serpent",{"title":244,"path":245,"stem":246},"CAST5 (ECB)","\u002Fciphers\u002Fcast5","2.ciphers\u002F51.cast5",{"title":248,"path":249,"stem":250},"OpenPGP (passphrase)","\u002Fciphers\u002Fopenpgp","2.ciphers\u002F52.openpgp",{"title":252,"path":253,"stem":254},"Stream","\u002Fciphers\u002Fstream","2.ciphers\u002F53.stream",{"title":256,"path":257,"stem":258},"Rabbit","\u002Fciphers\u002Frabbit","2.ciphers\u002F54.rabbit",{"title":260,"path":261,"stem":262},"RC4","\u002Fciphers\u002Frc4","2.ciphers\u002F55.rc4",{"title":264,"path":265,"stem":266},"XOR","\u002Fciphers\u002Fxor","2.ciphers\u002F56.xor",{"title":268,"path":269,"stem":270},"Salsa20","\u002Fciphers\u002Fsalsa20","2.ciphers\u002F57.salsa20",{"title":272,"path":273,"stem":274},"XSalsa20","\u002Fciphers\u002Fxsalsa20","2.ciphers\u002F58.xsalsa20",{"title":276,"path":277,"stem":278},"ChaCha20","\u002Fciphers\u002Fchacha20","2.ciphers\u002F59.chacha20",{"title":280,"path":281,"stem":282},"XChaCha20","\u002Fciphers\u002Fxchacha20","2.ciphers\u002F60.xchacha20",{"title":284,"path":285,"stem":286},"ChaCha20-Poly1305","\u002Fciphers\u002Fchacha20-poly1305","2.ciphers\u002F61.chacha20-poly1305","i-lucide-library",{"id":289,"title":96,"body":290,"description":526,"extension":527,"links":528,"meta":529,"navigation":530,"path":97,"seo":531,"stem":98,"__hash__":532},"docs\u002F2.ciphers\u002F14.hill.md",{"type":291,"value":292,"toc":521},"minimark",[293,297,301,306,321,431,438,442,445,490,501,505,514,517],[294,295],"cipher-facts",{"name":296},"hill",[298,299,300],"p",{},"Lester Hill published this one in 1929. It's where school algebra walks into a puzzle uninvited. Take two or three letters, turn them into numbers with A as 0, multiply by a matrix, mod 26. Every letter of the block feeds every letter of the result. Change one plaintext letter and the whole block changes. Caesar could never.",[302,303,305],"h2",{"id":304},"the-key","The key",[298,307,308,312,313,316,317,320],{},[309,310,311],"code",{},"key"," is the matrix spelled in letters, row by row. Four letters make a 2×2, nine make a 3×3. Anything else is an ",[309,314,315],{},"InvalidOptionError",". ",[309,318,319],{},"DDCF"," is the matrix 3 3 \u002F 2 5, and both of these are Wikipedia's examples:",[322,323,328],"pre",{"className":324,"code":325,"language":326,"meta":327,"style":327},"language-ts shiki shiki-themes ciphers ciphers ciphers","const hill = create(\"hill\");\nhill.encode(\"HELP\", { key: \"DDCF\" }).text; \u002F\u002F \"HIAT\"\nhill.decode(\"HIAT\", { key: \"DDCF\" }).text; \u002F\u002F \"HELP\"\nhill.encode(\"ACT CAT\", { key: \"GYBNQKURP\" }).text; \u002F\u002F \"POHFIN\"\n","ts","",[309,329,330,360,387,409],{"__ignoreMap":327},[331,332,335,339,343,346,350,353,357],"span",{"class":333,"line":334},"line",1,[331,336,338],{"class":337},"skH_V","const",[331,340,342],{"class":341},"s38Sx"," hill ",[331,344,345],{"class":337},"=",[331,347,349],{"class":348},"sK71F"," create",[331,351,352],{"class":341},"(",[331,354,356],{"class":355},"shU9J","\"hill\"",[331,358,359],{"class":341},");\n",[331,361,363,366,369,371,374,377,380,383],{"class":333,"line":362},2,[331,364,365],{"class":341},"hill.",[331,367,368],{"class":348},"encode",[331,370,352],{"class":341},[331,372,373],{"class":355},"\"HELP\"",[331,375,376],{"class":341},", { key: ",[331,378,379],{"class":355},"\"DDCF\"",[331,381,382],{"class":341}," }).text; ",[331,384,386],{"class":385},"scIB-","\u002F\u002F \"HIAT\"\n",[331,388,390,392,395,397,400,402,404,406],{"class":333,"line":389},3,[331,391,365],{"class":341},[331,393,394],{"class":348},"decode",[331,396,352],{"class":341},[331,398,399],{"class":355},"\"HIAT\"",[331,401,376],{"class":341},[331,403,379],{"class":355},[331,405,382],{"class":341},[331,407,408],{"class":385},"\u002F\u002F \"HELP\"\n",[331,410,412,414,416,418,421,423,426,428],{"class":333,"line":411},4,[331,413,365],{"class":341},[331,415,368],{"class":348},[331,417,352],{"class":341},[331,419,420],{"class":355},"\"ACT CAT\"",[331,422,376],{"class":341},[331,424,425],{"class":355},"\"GYBNQKURP\"",[331,427,382],{"class":341},[331,429,430],{"class":385},"\u002F\u002F \"POHFIN\"\n",[298,432,433,434,437],{},"Not every matrix works, though. Decoding multiplies by the inverse matrix, and that only exists when the determinant has no factor 2 or 13. ",[309,435,436],{},"ABCD"," has determinant 24. No inverse, no way back. Encoding with it would give ciphertext nobody can read, you included. So it's an error before the first letter, both ways. What's left is 157,248 keys at 2×2 and about 1.6 trillion at 3×3.",[302,439,441],{"id":440},"blocks-and-the-x","Blocks and the X",[298,443,444],{},"The text is cut down to letters and comes out in capitals with no spaces. Blocks run straight across word boundaries, so keeping the spaces would be a lie. A short last block gets an X. Always X:",[322,446,448],{"className":324,"code":447,"language":326,"meta":327,"style":327},"hill.encode(\"HEL\", { key: \"DDCF\" }).text; \u002F\u002F \"HIYH\"\nhill.decode(\"HIYH\", { key: \"DDCF\" }).text; \u002F\u002F \"HELX\"\n",[309,449,450,470],{"__ignoreMap":327},[331,451,452,454,456,458,461,463,465,467],{"class":333,"line":334},[331,453,365],{"class":341},[331,455,368],{"class":348},[331,457,352],{"class":341},[331,459,460],{"class":355},"\"HEL\"",[331,462,376],{"class":341},[331,464,379],{"class":355},[331,466,382],{"class":341},[331,468,469],{"class":385},"\u002F\u002F \"HIYH\"\n",[331,471,472,474,476,478,481,483,485,487],{"class":333,"line":362},[331,473,365],{"class":341},[331,475,394],{"class":348},[331,477,352],{"class":341},[331,479,480],{"class":355},"\"HIYH\"",[331,482,376],{"class":341},[331,484,379],{"class":355},[331,486,382],{"class":341},[331,488,489],{"class":385},"\u002F\u002F \"HELX\"\n",[298,491,492,493,496,497,500],{},"Decode keeps the X, same as ",[494,495,92],"a",{"href":93},". Padding or a real X? Only the sender knows. Ciphertext that doesn't split into whole blocks is a ",[309,498,499],{},"CipherError",", because a letter went missing somewhere.",[302,502,504],{"id":503},"spotting-one","Spotting one",[298,506,507,508,513],{},"So what gives a Hill away? Letters only, a count that divides by 2 or 3, counts as flat as a Vigenère's, and a J. The 5×5 squares of Playfair and Bifid can't make a J. Hill doesn't care. ",[494,509,510],{"href":17},[309,511,512],{},"guess"," names Hill on those signals, but never above medium. A Vigenère with its spaces gone looks exactly the same in a histogram.",[298,515,516],{},"It's also linear all the way down. Wikipedia puts it plainly: n² known plaintext letters and their ciphertext give a linear system, and the key falls out. Four letters of crib usually do it for a 2×2. That's the whole security story.",[518,519,520],"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":327,"searchDepth":362,"depth":362,"links":522},[523,524,525],{"id":304,"depth":362,"text":305},{"id":440,"depth":362,"text":441},{"id":503,"depth":362,"text":504},"Blocks of two or three letters go through a key matrix mod 26. Linear algebra in a puzzle. Nobody asked for it.","md",null,{},true,{"title":96,"description":526},"aC2c3knp1adBmn_ktq0syqZ7niOXePwFaVDUOuxfPPQ",[534,536],{"title":92,"path":93,"stem":94,"description":535,"children":-1},"Letter pairs through a keyed 5×5 table. J folds into I, doubled pairs are split with X, odd length is padded with X.",{"title":100,"path":101,"stem":102,"description":537,"children":-1},"Each letter becomes a row digit and a column digit in a 5×5 grid, I and J sharing a cell. An optional keyword reorders the grid.",1791419054999]