[{"data":1,"prerenderedAt":500},["ShallowReactive",2],{"navigation_docs":3,"-guide-analysis":116,"-guide-analysis-surround":495},[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-solar-book-2-linear",{"title":37,"path":38,"stem":39,"children":40,"icon":115},"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],{"title":42,"path":38,"stem":39},"Overview",{"title":44,"path":45,"stem":46},"Caesar","\u002Fciphers\u002Fcaesar","2.ciphers\u002F01.caesar",{"title":48,"path":49,"stem":50},"ROT-13","\u002Fciphers\u002Frot13","2.ciphers\u002F02.rot13",{"title":52,"path":53,"stem":54},"ROT-47","\u002Fciphers\u002Frot47","2.ciphers\u002F03.rot47",{"title":56,"path":57,"stem":58},"Atbash","\u002Fciphers\u002Fatbash","2.ciphers\u002F04.atbash",{"title":60,"path":61,"stem":62},"Affine","\u002Fciphers\u002Faffine","2.ciphers\u002F05.affine",{"title":64,"path":65,"stem":66},"Vigenère","\u002Fciphers\u002Fvigenere","2.ciphers\u002F06.vigenere",{"title":68,"path":69,"stem":70},"Trithemius","\u002Fciphers\u002Ftrithemius","2.ciphers\u002F07.trithemius",{"title":72,"path":73,"stem":74},"Alberti","\u002Fciphers\u002Falberti","2.ciphers\u002F08.alberti",{"title":76,"path":77,"stem":78},"Playfair","\u002Fciphers\u002Fplayfair","2.ciphers\u002F09.playfair",{"title":80,"path":81,"stem":82},"Polybius square","\u002Fciphers\u002Fpolybius","2.ciphers\u002F10.polybius",{"title":84,"path":85,"stem":86},"Morse code","\u002Fciphers\u002Fmorse","2.ciphers\u002F11.morse",{"title":88,"path":89,"stem":90},"Bacon's cipher","\u002Fciphers\u002Fbacon","2.ciphers\u002F12.bacon",{"title":92,"path":93,"stem":94},"Tap code","\u002Fciphers\u002Ftap-code","2.ciphers\u002F13.tap-code",{"title":96,"path":97,"stem":98},"ADFGVX","\u002Fciphers\u002Fadfgvx","2.ciphers\u002F14.adfgvx",{"title":100,"path":101,"stem":102},"Bifid","\u002Fciphers\u002Fbifid","2.ciphers\u002F15.bifid",{"title":104,"path":105,"stem":106},"Rail fence","\u002Fciphers\u002Frail-fence","2.ciphers\u002F16.rail-fence",{"title":108,"path":109,"stem":110},"Columnar transposition","\u002Fciphers\u002Fcolumnar","2.ciphers\u002F17.columnar",{"title":112,"path":113,"stem":114},"Enigma M3","\u002Fciphers\u002Fenigma","2.ciphers\u002F18.enigma","i-solar-library-linear",{"id":117,"title":16,"body":118,"description":488,"extension":489,"links":490,"meta":491,"navigation":237,"path":17,"seo":493,"stem":18,"__hash__":494},"docs\u002F1.guide\u002F03.analysis.md",{"type":119,"value":120,"toc":482},"minimark",[121,126,130,164,172,189,193,329,346,406,410,413,426,433,437,475,478],[122,123,125],"h2",{"id":124},"brute-force","Brute force",[127,128,129],"p",{},"A Caesar has 25 keys. The attack is all of them, then read:",[131,132,137],"pre",{"className":133,"code":134,"language":135,"meta":136,"style":136},"language-bash shiki shiki-themes github-light github-light poimandres","ciphers brute \"KHOOR ZRUOG\"\n","bash","",[138,139,140],"code",{"__ignoreMap":136},[141,142,145,149,153,157,161],"span",{"class":143,"line":144},"line",1,[141,146,148],{"class":147},"sseY5","ciphers",[141,150,152],{"class":151},"sX7Zv"," brute",[141,154,156],{"class":155},"scVjq"," \"",[141,158,160],{"class":159},"sQ7BG","KHOOR ZRUOG",[141,162,163],{"class":155},"\"\n",[131,165,170],{"className":166,"code":168,"language":169},[167],"language-text","  shift= 1 → JGNNQ YQTNF\n  shift= 2 → IFMMP XPSME\n  shift= 3 → HELLO WORLD\n  ...\n","text",[138,171,168],{"__ignoreMap":136},[127,173,174,175,178,179,182,183,188],{},"There is no dedicated function for this in the library, and there shouldn't be. It's ",[138,176,177],{},"create(\"caesar\").decode(text, { shift })"," in a loop from 1 to 25 - that's what the command, the ",[138,180,181],{},"cipher_brute_caesar"," tool and the ",[184,185,187],"a",{"href":186},"\u002F","landing panel"," run. Shift 0 is not on the list. It would be the input, and the library refuses it as a shift anyway.",[122,190,192],{"id":191},"frequency","Frequency",[131,194,198],{"className":195,"code":196,"language":197,"meta":136,"style":136},"language-ts shiki shiki-themes github-light github-light poimandres","import { analyzeFrequency } from \"@agntn\u002Fciphers\";\n\nconst analysis = analyzeFrequency(\"DWWDFN DW GDZQ\", \"en\");\nanalysis?.counts; \u002F\u002F [[\"D\", 4], [\"W\", 3], [\"F\", 1], ...] sorted by count\nanalysis?.reference; \u002F\u002F \"ETAOINSHRDLCUMWFGYPBVKJXQZ\"\nanalysis?.ic; \u002F\u002F index of coincidence\n","ts",[138,199,200,232,239,279,299,314],{"__ignoreMap":136},[141,201,202,206,210,214,217,221,223,226,229],{"class":143,"line":144},[141,203,205],{"class":204},"sP0CR","import",[141,207,209],{"class":208},"sKlNE"," {",[141,211,213],{"class":212},"snHMy"," analyzeFrequency",[141,215,216],{"class":208}," }",[141,218,220],{"class":219},"stCPd"," from",[141,222,156],{"class":155},[141,224,225],{"class":159},"@agntn\u002Fciphers",[141,227,228],{"class":155},"\"",[141,230,231],{"class":208},";\n",[141,233,235],{"class":143,"line":234},2,[141,236,238],{"emptyLinePlaceholder":237},true,"\n",[141,240,242,246,250,253,256,259,261,264,266,269,271,274,276],{"class":143,"line":241},3,[141,243,245],{"class":244},"s1TYA","const",[141,247,249],{"class":248},"saoiD"," analysis",[141,251,252],{"class":244}," =",[141,254,213],{"class":255},"sULi6",[141,257,258],{"class":208},"(",[141,260,228],{"class":155},[141,262,263],{"class":159},"DWWDFN DW GDZQ",[141,265,228],{"class":155},[141,267,268],{"class":208},", ",[141,270,228],{"class":155},[141,272,273],{"class":159},"en",[141,275,228],{"class":155},[141,277,278],{"class":208},");\n",[141,280,282,286,289,292,295],{"class":143,"line":281},4,[141,283,285],{"class":284},"spVlQ","analysis",[141,287,288],{"class":208},"?.",[141,290,291],{"class":284},"counts",[141,293,294],{"class":208},"; ",[141,296,298],{"class":297},"sjhu3","\u002F\u002F [[\"D\", 4], [\"W\", 3], [\"F\", 1], ...] sorted by count\n",[141,300,302,304,306,309,311],{"class":143,"line":301},5,[141,303,285],{"class":284},[141,305,288],{"class":208},[141,307,308],{"class":284},"reference",[141,310,294],{"class":208},[141,312,313],{"class":297},"\u002F\u002F \"ETAOINSHRDLCUMWFGYPBVKJXQZ\"\n",[141,315,317,319,321,324,326],{"class":143,"line":316},6,[141,318,285],{"class":284},[141,320,288],{"class":208},[141,322,323],{"class":284},"ic",[141,325,294],{"class":208},[141,327,328],{"class":297},"\u002F\u002F index of coincidence\n",[127,330,331,334,335,338,339,341,342,345],{},[138,332,333],{},"analyzeFrequency(text, language)"," uppercases, drops everything outside A to Z and counts. No letters at all - ",[138,336,337],{},"undefined",", not an empty table, so check before you read. The language picks the reference order, ",[138,340,273],{}," or ",[138,343,344],{},"pl",".",[347,348,349,362],"table",{},[350,351,352],"thead",{},[353,354,355,359],"tr",{},[356,357,358],"th",{},"Field",[356,360,361],{},"Meaning",[363,364,365,376,388,397],"tbody",{},[353,366,367,373],{},[368,369,370],"td",{},[138,371,372],{},"total",[368,374,375],{},"Letters counted",[353,377,378,382],{},[368,379,380],{},[138,381,291],{},[368,383,384,387],{},[138,385,386],{},"[letter, count]"," pairs, most frequent first",[353,389,390,394],{},[368,391,392],{},[138,393,308],{},[368,395,396],{},"Expected order for the language",[353,398,399,403],{},[368,400,401],{},[138,402,323],{},[368,404,405],{},"Index of coincidence, missing with fewer than two letters",[122,407,409],{"id":408},"reading-the-index-of-coincidence","Reading the index of coincidence",[127,411,412],{},"The IC is the chance that two letters picked from the text are the same. English sits near 0.067, uniform random near 0.038. That one number tells you which family you are looking at before you try a single key:",[414,415,416,420,423],"ul",{},[417,418,419],"li",{},"Monoalphabetic substitution (Caesar, Atbash, Affine) keeps the histogram shape and only relabels the bars. IC stays high, and the tallest ciphertext letter is probably E.",[417,421,422],{},"Polyalphabetic (Vigenère, Alberti) spreads one plaintext letter over several ciphertext letters. IC drops toward 0.038 and the histogram goes flat. Time to look for a period.",[417,424,425],{},"Transposition (rail fence, columnar) moves letters without changing them. The histogram is the plaintext's, only the words are gone.",[127,427,428,429,432],{},"The ",[184,430,32],{"href":431},"\u002Fplayground"," draws the histogram for any text, expected order next to actual.",[122,434,436],{"id":435},"the-cli","The CLI",[131,438,440],{"className":133,"code":439,"language":135,"meta":136,"style":136},"ciphers frequency \"DWWDFN DW GDZQ\"\nciphers frequency \"ZAŻÓŁĆ GĘŚLĄ JAŹŃ\" --lang pl\n",[138,441,442,455],{"__ignoreMap":136},[141,443,444,446,449,451,453],{"class":143,"line":144},[141,445,148],{"class":147},[141,447,448],{"class":151}," frequency",[141,450,156],{"class":155},[141,452,263],{"class":159},[141,454,163],{"class":155},[141,456,457,459,461,463,466,468,472],{"class":143,"line":234},[141,458,148],{"class":147},[141,460,448],{"class":151},[141,462,156],{"class":155},[141,464,465],{"class":159},"ZAŻÓŁĆ GĘŚLĄ JAŹŃ",[141,467,228],{"class":155},[141,469,471],{"class":470},"sqT1Y"," --lang",[141,473,474],{"class":151}," pl\n",[127,476,477],{},"One bar per letter, expected and actual order, then the IC with the two reference values next to it so you don't have to remember them.",[479,480,481],"style",{},"html pre.shiki code .sseY5, html code.shiki .sseY5{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#91B4D5}html pre.shiki code .sX7Zv, html code.shiki .sX7Zv{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#ADD7FF}html pre.shiki code .scVjq, html code.shiki .scVjq{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#A6ACCD}html pre.shiki code .sQ7BG, html code.shiki .sQ7BG{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#5DE4C7}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);}html pre.shiki code .sP0CR, html code.shiki .sP0CR{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7}html pre.shiki code .sKlNE, html code.shiki .sKlNE{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#A6ACCD}html pre.shiki code .snHMy, html code.shiki .snHMy{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#ADD7FF}html pre.shiki code .stCPd, html code.shiki .stCPd{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#A6ACCD}html pre.shiki code .s1TYA, html code.shiki .s1TYA{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#91B4D5}html pre.shiki code .saoiD, html code.shiki .saoiD{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#E4F0FB}html pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}html pre.shiki code .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html pre.shiki code .sjhu3, html code.shiki .sjhu3{--shiki-light:#6A737D;--shiki-light-font-style:inherit;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#767C9DB0;--shiki-dark-font-style:italic}html pre.shiki code .sqT1Y, html code.shiki .sqT1Y{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#ADD7FF}",{"title":136,"searchDepth":234,"depth":234,"links":483},[484,485,486,487],{"id":124,"depth":234,"text":125},{"id":191,"depth":234,"text":192},{"id":408,"depth":234,"text":409},{"id":435,"depth":234,"text":436},"Brute force a Caesar with all 25 shifts. Read a histogram and the index of coincidence before guessing a key.","md",null,{"icon":492},"i-solar-chart-linear",{"title":16,"description":488},"TM-K9UXZOrUlr3tT14DRTurHNVff6km7uJoib5xwm_c",[496,498],{"title":12,"path":13,"stem":14,"description":497,"children":-1},"The two methods every cipher has, the two options they share, and what happens to case and punctuation on the way through.",{"title":20,"path":21,"stem":22,"description":499,"children":-1},"The ciphers command, seven subcommands, and the flags each cipher reads.",1788614951661]