[{"data":1,"prerenderedAt":577},["ShallowReactive",2],{"navigation_docs":3,"-ciphers-gronsfeld":304,"-ciphers-gronsfeld-surround":572},[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":76,"body":306,"description":565,"extension":566,"links":567,"meta":568,"navigation":569,"path":77,"seo":570,"stem":78,"__hash__":571},"docs\u002F2.ciphers\u002F09.gronsfeld.md",{"type":307,"value":308,"toc":560},"minimark",[309,313,326,415,425,430,460,464,487,491,504,549,556],[310,311],"cipher-facts",{"name":312},"gronsfeld",[314,315,316,317,320,321,325],"p",{},"Gronsfeld is ",[318,319,72],"a",{"href":73}," with a number for a key. Each digit shifts one letter by 0 to 9, and the key repeats. So ",[322,323,324],"code",{},"1234"," moves the first letter by one, the second by two, and so on. A PIN, a date, a phone number, the digits of pi. Who looks twice at four digits on a sticky note?",[327,328,333],"pre",{"className":329,"code":330,"language":331,"meta":332,"style":332},"language-ts shiki shiki-themes ciphers ciphers ciphers","const gronsfeld = create(\"gronsfeld\");\ngronsfeld.encode(\"GRONSFELD\", { key: \"1234\" }).text; \u002F\u002F \"HTRRTHHPE\"\ngronsfeld.decode(\"EEREG\", { key: \"123\" }).text; \u002F\u002F \"DCODE\"\n","ts","",[322,334,335,365,392],{"__ignoreMap":332},[336,337,340,344,348,351,355,358,362],"span",{"class":338,"line":339},"line",1,[336,341,343],{"class":342},"skH_V","const",[336,345,347],{"class":346},"s38Sx"," gronsfeld ",[336,349,350],{"class":342},"=",[336,352,354],{"class":353},"sK71F"," create",[336,356,357],{"class":346},"(",[336,359,361],{"class":360},"shU9J","\"gronsfeld\"",[336,363,364],{"class":346},");\n",[336,366,368,371,374,376,379,382,385,388],{"class":338,"line":367},2,[336,369,370],{"class":346},"gronsfeld.",[336,372,373],{"class":353},"encode",[336,375,357],{"class":346},[336,377,378],{"class":360},"\"GRONSFELD\"",[336,380,381],{"class":346},", { key: ",[336,383,384],{"class":360},"\"1234\"",[336,386,387],{"class":346}," }).text; ",[336,389,391],{"class":390},"scIB-","\u002F\u002F \"HTRRTHHPE\"\n",[336,393,395,397,400,402,405,407,410,412],{"class":338,"line":394},3,[336,396,370],{"class":346},[336,398,399],{"class":353},"decode",[336,401,357],{"class":346},[336,403,404],{"class":360},"\"EEREG\"",[336,406,381],{"class":346},[336,408,409],{"class":360},"\"123\"",[336,411,387],{"class":346},[336,413,414],{"class":390},"\u002F\u002F \"DCODE\"\n",[314,416,417,418,424],{},"Both are the worked examples from ",[318,419,423],{"href":420,"rel":421},"https:\u002F\u002Fwww.dcode.fr\u002Fgronsfeld-cipher",[422],"nofollow","dCode",".",[426,427,429],"h2",{"id":428},"why-is-the-key-a-string","Why is the key a string?",[314,431,432,433,436,437,440,441,444,445,447,448,451,452,455,456,459],{},"Because ",[322,434,435],{},"0123"," and ",[322,438,439],{},"123"," are different keys. A number eats the leading zero, and then every letter gets the wrong shift. So ",[322,442,443],{},"key"," is a string of digits and nothing else. Spaces, dashes, letters and a plain ",[322,446,324],{}," number are all an ",[322,449,450],{},"InvalidOptionError",". No key at all is a ",[322,453,454],{},"MissingOptionError",". On the CLI ",[322,457,458],{},"--key 0123"," stays a string, zero included.",[426,461,463],{"id":462},"the-vigenère-inside","The Vigenère inside",[314,465,466,467,472,473,475,476,479,480,436,483,486],{},"Digit d is the Vigenère key letter d places after A. ",[318,468,471],{"href":469,"rel":470},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FVigen%C3%A8re_cipher#Gronsfeld_cipher",[422],"Wikipedia"," puts it in one line: Gronsfeld ",[322,474,435],{}," is Vigenère ",[322,477,478],{},"ABCD",". The rest is Vigenère too. Spaces, punctuation and anything outside A to Z pass through without moving the key. ",[322,481,482],{},"preserveCase",[322,484,485],{},"stripNonAlpha"," work the same way.",[426,488,490],{"id":489},"why-its-weak","Why it's weak",[314,492,493,494,499,500,503],{},"Ten shifts per key position instead of 26. A five digit key has 100,000 values, fewer than Vigenère has keys of four letters. And every Vigenère attack still works. ",[318,495,496],{"href":17},[322,497,498],{},"period"," finds the key length. ",[322,501,502],{},"recover"," has no Gronsfeld mode and doesn't need one:",[327,505,507],{"className":329,"code":506,"language":331,"meta":332,"style":332},"const secret = gronsfeld.encode(englishText, { key: \"31415\" }).text;\nrecoverKey(secret, { cipher: \"vigenere\" }).candidates[0].key; \u002F\u002F \"DBEBF\"\n",[322,508,509,532],{"__ignoreMap":332},[336,510,511,513,516,518,521,523,526,529],{"class":338,"line":339},[336,512,343],{"class":342},[336,514,515],{"class":346}," secret ",[336,517,350],{"class":342},[336,519,520],{"class":346}," gronsfeld.",[336,522,373],{"class":353},[336,524,525],{"class":346},"(englishText, { key: ",[336,527,528],{"class":360},"\"31415\"",[336,530,531],{"class":346}," }).text;\n",[336,533,534,537,540,543,546],{"class":338,"line":367},[336,535,536],{"class":353},"recoverKey",[336,538,539],{"class":346},"(secret, { cipher: ",[336,541,542],{"class":360},"\"vigenere\"",[336,544,545],{"class":346}," }).candidates[0].key; ",[336,547,548],{"class":390},"\u002F\u002F \"DBEBF\"\n",[314,550,551,552,555],{},"A Vigenère key made only of A to J is a Gronsfeld key in disguise. Read it back as digits and ",[322,553,554],{},"DBEBF"," is 31415. Pi, of course.",[557,558,559],"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":332,"searchDepth":367,"depth":367,"links":561},[562,563,564],{"id":428,"depth":367,"text":429},{"id":462,"depth":367,"text":463},{"id":489,"depth":367,"text":490},"Vigenère with a number for a key. Each digit shifts one letter by 0 to 9, so a PIN or a date makes a perfectly good key.","md",null,{},true,{"title":76,"description":565},"aXkQ_1qte1Ui3e7stbTMWj5Pw359F_Yzw5mLLx3yC98",[573,575],{"title":72,"path":73,"stem":74,"description":574,"children":-1},"A keyword picks a different Caesar shift for each letter. Keyspace 26 to the key length, weakness is the period.",{"title":80,"path":81,"stem":82,"description":576,"children":-1},"Subtract each letter from a repeating key. The same operation encodes and decodes.",1791461057078]