[{"data":1,"prerenderedAt":808},["ShallowReactive",2],{"guide-rot13-programming-puzzles":3},{"id":4,"title":5,"body":6,"date":800,"description":801,"extension":802,"meta":803,"navigation":225,"path":804,"readingTime":198,"seo":805,"stem":806,"__hash__":807},"guides\u002Fguides\u002Frot13-programming-puzzles.md","ROT13 in Programming Puzzles",{"type":7,"value":8,"toc":774},"minimark",[9,14,18,21,25,30,33,115,127,131,141,145,149,245,249,427,431,456,460,464,467,475,479,482,488,491,495,498,511,578,582,586,593,596,600,605,608,612,617,620,624,695,699,733,737,758,762,770],[10,11,13],"h2",{"id":12},"rot13-as-a-puzzle-element","ROT13 as a Puzzle Element",[15,16,17],"p",{},"ROT13 is one of the most common ciphers in programming puzzles. Not because it is hard to break — it is trivially reversible — but because it tests whether you recognize patterns and understand basic string manipulation.",[15,19,20],{},"Puzzle designers love ROT13 because it satisfies two constraints: it obscures answers from casual reading, and it is trivially reversible without any key or tool. Readers can decode it mentally once they practice.",[10,22,24],{"id":23},"spotting-rot13-in-the-wild","Spotting ROT13 in the Wild",[26,27,29],"h3",{"id":28},"visual-tells","Visual tells",[15,31,32],{},"ROT13-encoded text has recognizable patterns:",[34,35,36,49],"table",{},[37,38,39],"thead",{},[40,41,42,46],"tr",{},[43,44,45],"th",{},"Pattern",[43,47,48],{},"Why it happens",[50,51,52,61,89,102],"tbody",{},[40,53,54,58],{},[55,56,57],"td",{},"Words look \"shifted\" — vowels map to different vowels",[55,59,60],{},"A↔N, E↔R, I↔V, O↔B, U↔H",[40,62,63,66],{},[55,64,65],{},"Common short words transform predictably",[55,67,68,72,73,76,77,72,80,76,83,72,86],{},[69,70,71],"code",{},"the"," → ",[69,74,75],{},"gur",", ",[69,78,79],{},"and",[69,81,82],{},"naq",[69,84,85],{},"for",[69,87,88],{},"sbe",[40,90,91,94],{},[55,92,93],{},"Capitalization is preserved",[55,95,96,72,99],{},[69,97,98],{},"Hello",[69,100,101],{},"Uryyb",[40,103,104,107],{},[55,105,106],{},"Numbers and punctuation are untouched",[55,108,109,72,112],{},[69,110,111],{},"Pass: 42!",[69,113,114],{},"Cnff: 42!",[15,116,117,118,120,121,123,124,126],{},"The word ",[69,119,75],{}," is the biggest giveaway — it appears frequently in English text, and ROT13 maps ",[69,122,71],{}," to ",[69,125,75],{}," every time.",[26,128,130],{"id":129},"frequency-analysis-shortcut","Frequency analysis shortcut",[15,132,133,134,136,137,140],{},"Do not bother with full frequency analysis. If the most common three-letter word in the ciphertext is ",[69,135,75],{},", you have ROT13. If the most common word is ",[69,138,139],{},"fi",", you might have ROT2. For puzzle purposes, recognition is faster than computation.",[10,142,144],{"id":143},"implementing-rot13-in-puzzles","Implementing ROT13 in Puzzles",[26,146,148],{"id":147},"python-most-common-in-ctfs","Python — most common in CTFs",[150,151,156],"pre",{"className":152,"code":153,"language":154,"meta":155,"style":155},"language-python shiki shiki-themes github-light github-dark","def rot13(text):\n    result = []\n    for char in text:\n        if 'a' \u003C= char \u003C= 'z':\n            result.append(chr((ord(char) - ord('a') + 13) % 26 + ord('a')))\n        elif 'A' \u003C= char \u003C= 'Z':\n            result.append(chr((ord(char) - ord('A') + 13) % 26 + ord('A')))\n        else:\n            result.append(char)\n    return ''.join(result)\n\n# Or use the built-in codec\nimport codecs\ncodecs.encode('Hello World', 'rot_13')  # 'Uryyb Jbeyq'\n","python","",[69,157,158,166,172,178,184,190,196,202,208,214,220,227,233,239],{"__ignoreMap":155},[159,160,163],"span",{"class":161,"line":162},"line",1,[159,164,165],{},"def rot13(text):\n",[159,167,169],{"class":161,"line":168},2,[159,170,171],{},"    result = []\n",[159,173,175],{"class":161,"line":174},3,[159,176,177],{},"    for char in text:\n",[159,179,181],{"class":161,"line":180},4,[159,182,183],{},"        if 'a' \u003C= char \u003C= 'z':\n",[159,185,187],{"class":161,"line":186},5,[159,188,189],{},"            result.append(chr((ord(char) - ord('a') + 13) % 26 + ord('a')))\n",[159,191,193],{"class":161,"line":192},6,[159,194,195],{},"        elif 'A' \u003C= char \u003C= 'Z':\n",[159,197,199],{"class":161,"line":198},7,[159,200,201],{},"            result.append(chr((ord(char) - ord('A') + 13) % 26 + ord('A')))\n",[159,203,205],{"class":161,"line":204},8,[159,206,207],{},"        else:\n",[159,209,211],{"class":161,"line":210},9,[159,212,213],{},"            result.append(char)\n",[159,215,217],{"class":161,"line":216},10,[159,218,219],{},"    return ''.join(result)\n",[159,221,223],{"class":161,"line":222},11,[159,224,226],{"emptyLinePlaceholder":225},true,"\n",[159,228,230],{"class":161,"line":229},12,[159,231,232],{},"# Or use the built-in codec\n",[159,234,236],{"class":161,"line":235},13,[159,237,238],{},"import codecs\n",[159,240,242],{"class":161,"line":241},14,[159,243,244],{},"codecs.encode('Hello World', 'rot_13')  # 'Uryyb Jbeyq'\n",[26,246,248],{"id":247},"javascript-browser-based-puzzles","JavaScript — browser-based puzzles",[150,250,254],{"className":251,"code":252,"language":253,"meta":155,"style":155},"language-javascript shiki shiki-themes github-light github-dark","function rot13(str) {\n  return str.replace(\u002F[a-zA-Z]\u002Fg, char => {\n    const base = char \u003C= 'Z' ? 65 : 97\n    return String.fromCharCode((char.charCodeAt(0) - base + 13) % 26 + base)\n  })\n}\n\nrot13('Hello World') \u002F\u002F 'Uryyb Jbeyq'\n","javascript",[69,255,256,277,314,346,397,402,407,411],{"__ignoreMap":155},[159,257,258,262,266,270,274],{"class":161,"line":162},[159,259,261],{"class":260},"szBVR","function",[159,263,265],{"class":264},"sScJk"," rot13",[159,267,269],{"class":268},"sVt8B","(",[159,271,273],{"class":272},"s4XuR","str",[159,275,276],{"class":268},") {\n",[159,278,279,282,285,288,290,294,298,300,303,305,308,311],{"class":161,"line":168},[159,280,281],{"class":260},"  return",[159,283,284],{"class":268}," str.",[159,286,287],{"class":264},"replace",[159,289,269],{"class":268},[159,291,293],{"class":292},"sZZnC","\u002F",[159,295,297],{"class":296},"sj4cs","[a-zA-Z]",[159,299,293],{"class":292},[159,301,302],{"class":260},"g",[159,304,76],{"class":268},[159,306,307],{"class":272},"char",[159,309,310],{"class":260}," =>",[159,312,313],{"class":268}," {\n",[159,315,316,319,322,325,328,331,334,337,340,343],{"class":161,"line":174},[159,317,318],{"class":260},"    const",[159,320,321],{"class":296}," base",[159,323,324],{"class":260}," =",[159,326,327],{"class":268}," char ",[159,329,330],{"class":260},"\u003C=",[159,332,333],{"class":292}," 'Z'",[159,335,336],{"class":260}," ?",[159,338,339],{"class":296}," 65",[159,341,342],{"class":260}," :",[159,344,345],{"class":296}," 97\n",[159,347,348,351,354,357,360,363,365,368,371,374,377,380,383,385,388,391,394],{"class":161,"line":180},[159,349,350],{"class":260},"    return",[159,352,353],{"class":268}," String.",[159,355,356],{"class":264},"fromCharCode",[159,358,359],{"class":268},"((char.",[159,361,362],{"class":264},"charCodeAt",[159,364,269],{"class":268},[159,366,367],{"class":296},"0",[159,369,370],{"class":268},") ",[159,372,373],{"class":260},"-",[159,375,376],{"class":268}," base ",[159,378,379],{"class":260},"+",[159,381,382],{"class":296}," 13",[159,384,370],{"class":268},[159,386,387],{"class":260},"%",[159,389,390],{"class":296}," 26",[159,392,393],{"class":260}," +",[159,395,396],{"class":268}," base)\n",[159,398,399],{"class":161,"line":186},[159,400,401],{"class":268},"  })\n",[159,403,404],{"class":161,"line":192},[159,405,406],{"class":268},"}\n",[159,408,409],{"class":161,"line":198},[159,410,226],{"emptyLinePlaceholder":225},[159,412,413,416,418,421,423],{"class":161,"line":204},[159,414,415],{"class":264},"rot13",[159,417,269],{"class":268},[159,419,420],{"class":292},"'Hello World'",[159,422,370],{"class":268},[159,424,426],{"class":425},"sJ8bj","\u002F\u002F 'Uryyb Jbeyq'\n",[26,428,430],{"id":429},"one-liner-for-quick-decoding","One-liner for quick decoding",[150,432,434],{"className":152,"code":433,"language":154,"meta":155,"style":155},"# Python\ndecode = lambda s: s.translate(str.maketrans(\n    'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n    'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'))\n",[69,435,436,441,446,451],{"__ignoreMap":155},[159,437,438],{"class":161,"line":162},[159,439,440],{},"# Python\n",[159,442,443],{"class":161,"line":168},[159,444,445],{},"decode = lambda s: s.translate(str.maketrans(\n",[159,447,448],{"class":161,"line":174},[159,449,450],{},"    'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n",[159,452,453],{"class":161,"line":180},[159,454,455],{},"    'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'))\n",[10,457,459],{"id":458},"rot13-in-ctf-challenges","ROT13 in CTF Challenges",[26,461,463],{"id":462},"direct-encoding","Direct encoding",[15,465,466],{},"The simplest form: you find a ROT13-encoded string in a file, HTTP header, or database entry. Decode it to get the flag.",[150,468,473],{"className":469,"code":471,"language":472},[470],"language-text","Flag: synt{gur_qrpelcgvba_vf_njnvt}\n→ flag{the_decryption_is_alawi}\n","text",[69,474,471],{"__ignoreMap":155},[26,476,478],{"id":477},"chained-encodings","Chained encodings",[15,480,481],{},"Puzzle creators layer encodings. A common pattern: Base64 wrapping ROT13, or ROT13 inside a hex string.",[150,483,486],{"className":484,"code":485,"language":472},[470],"Step 1: Decode Base64 → \"gur synt vf urer\"\nStep 2: Decode ROT13 → \"the flag is here\"\n",[69,487,485],{"__ignoreMap":155},[15,489,490],{},"The trick is to try ROT13 at every stage. If the decoded output looks like shifted English, it is probably ROT13.",[26,492,494],{"id":493},"rot-n-variants","ROT-N variants",[15,496,497],{},"Sometimes the puzzle uses a different rotation. The approach:",[499,500,501,505,508],"ol",{},[502,503,504],"li",{},"Decode with all 25 possible rotations",[502,506,507],{},"Scan the results for English words",[502,509,510],{},"The rotation that produces readable text is the answer",[150,512,514],{"className":152,"code":513,"language":154,"meta":155,"style":155},"def rot_n(text, n):\n    result = []\n    for char in text:\n        if 'a' \u003C= char \u003C= 'z':\n            result.append(chr((ord(char) - ord('a') + n) % 26 + ord('a')))\n        elif 'A' \u003C= char \u003C= 'Z':\n            result.append(chr((ord(char) - ord('A') + n) % 26 + ord('A')))\n        else:\n            result.append(char)\n    return ''.join(result)\n\n# Brute-force all rotations\nfor i in range(26):\n    print(f\"ROT{i}: {rot_n(ciphertext, i)}\")\n",[69,515,516,521,525,529,533,538,542,547,551,555,559,563,568,573],{"__ignoreMap":155},[159,517,518],{"class":161,"line":162},[159,519,520],{},"def rot_n(text, n):\n",[159,522,523],{"class":161,"line":168},[159,524,171],{},[159,526,527],{"class":161,"line":174},[159,528,177],{},[159,530,531],{"class":161,"line":180},[159,532,183],{},[159,534,535],{"class":161,"line":186},[159,536,537],{},"            result.append(chr((ord(char) - ord('a') + n) % 26 + ord('a')))\n",[159,539,540],{"class":161,"line":192},[159,541,195],{},[159,543,544],{"class":161,"line":198},[159,545,546],{},"            result.append(chr((ord(char) - ord('A') + n) % 26 + ord('A')))\n",[159,548,549],{"class":161,"line":204},[159,550,207],{},[159,552,553],{"class":161,"line":210},[159,554,213],{},[159,556,557],{"class":161,"line":216},[159,558,219],{},[159,560,561],{"class":161,"line":222},[159,562,226],{"emptyLinePlaceholder":225},[159,564,565],{"class":161,"line":229},[159,566,567],{},"# Brute-force all rotations\n",[159,569,570],{"class":161,"line":235},[159,571,572],{},"for i in range(26):\n",[159,574,575],{"class":161,"line":241},[159,576,577],{},"    print(f\"ROT{i}: {rot_n(ciphertext, i)}\")\n",[10,579,581],{"id":580},"interview-puzzles-involving-rot13","Interview Puzzles Involving ROT13",[26,583,585],{"id":584},"classic-caesar-cipher-decoder","Classic: Caesar cipher decoder",[15,587,588,592],{},[589,590,591],"strong",{},"Prompt:"," Write a function that takes a string and returns all 26 possible Caesar cipher decodings.",[15,594,595],{},"This tests string manipulation, modular arithmetic, and code clarity. The ROT13 case is just one of the 26 outputs.",[26,597,599],{"id":598},"classic-detect-the-rotation","Classic: Detect the rotation",[15,601,602,604],{},[589,603,591],{}," Given a ciphertext and a list of dictionary words, determine which Caesar rotation was used.",[15,606,607],{},"This tests frequency analysis or simple brute-force matching against a word list.",[26,609,611],{"id":610},"tricky-rot13-in-url-routing","Tricky: ROT13 in URL routing",[15,613,614,616],{},[589,615,591],{}," A web application uses ROT13 to \"encrypt\" URL parameters. Describe the security implication and fix it.",[15,618,619],{},"The answer: ROT13 is not encryption. Anyone can decode it. Use proper encryption or signed tokens instead.",[10,621,623],{"id":622},"practice-resources","Practice Resources",[34,625,626,639],{},[37,627,628],{},[40,629,630,633,636],{},[43,631,632],{},"Resource",[43,634,635],{},"Type",[43,637,638],{},"ROT13 Frequency",[50,640,641,652,663,674,685],{},[40,642,643,646,649],{},[55,644,645],{},"Cryptopals Challenge Set 1",[55,647,648],{},"Crypto CTF",[55,650,651],{},"Moderate",[40,653,654,657,660],{},[55,655,656],{},"OverTheWire Bandit",[55,658,659],{},"Linux CTF",[55,661,662],{},"Occasional",[40,664,665,668,671],{},[55,666,667],{},"PicoCTF",[55,669,670],{},"Beginner CTF",[55,672,673],{},"Frequent",[40,675,676,679,682],{},[55,677,678],{},"Codewars \"Rot13\" kata",[55,680,681],{},"Coding challenge",[55,683,684],{},"Direct",[40,686,687,690,693],{},[55,688,689],{},"Advent of Code (various years)",[55,691,692],{},"Puzzle advent",[55,694,662],{},[10,696,698],{"id":697},"key-takeaways","Key Takeaways",[700,701,702,705,714,721,724,727,730],"ul",{},[502,703,704],{},"ROT13 appears constantly in puzzles because it is trivial to implement and reverse",[502,706,707,708,710,711,713],{},"Learn to recognize ",[69,709,75],{}," (ROT13 of ",[69,712,71],{},") — it is the fastest identifier",[502,715,716,717,720],{},"Python's ",[69,718,719],{},"codecs.encode(text, 'rot_13')"," is the quickest decode method",[502,722,723],{},"CTF puzzles often chain ROT13 with Base64 or hex encoding",[502,725,726],{},"When the rotation is unknown, brute-force all 25 possibilities and scan for English",[502,728,729],{},"ROT13 interview questions test string manipulation and modular arithmetic fundamentals",[502,731,732],{},"Never use ROT13 for actual security — puzzles are its legitimate domain",[10,734,736],{"id":735},"related-guides","Related Guides",[700,738,739,746,752],{},[502,740,741],{},[742,743,745],"a",{"href":744},"\u002Fguides\u002Frot13-explained","ROT13 Explained",[502,747,748],{},[742,749,751],{"href":750},"\u002Fguides\u002Fcaesar-cipher-variations-explained","Caesar Cipher Variations Explained",[502,753,754],{},[742,755,757],{"href":756},"\u002Fguides\u002Ftext-encoding-methods","Text Encoding Methods",[10,759,761],{"id":760},"try-it-yourself","Try It Yourself",[15,763,764,765,769],{},"Decode ROT13 instantly with our free ",[742,766,768],{"href":767},"\u002Ftools\u002Frot13","ROT13 Tool",". Paste any ciphertext — puzzle clue, spoiler, or encoded flag — and get the plaintext in one click.",[771,772,773],"style",{},"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 .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":155,"searchDepth":168,"depth":168,"links":775},[776,777,781,786,791,796,797,798,799],{"id":12,"depth":168,"text":13},{"id":23,"depth":168,"text":24,"children":778},[779,780],{"id":28,"depth":174,"text":29},{"id":129,"depth":174,"text":130},{"id":143,"depth":168,"text":144,"children":782},[783,784,785],{"id":147,"depth":174,"text":148},{"id":247,"depth":174,"text":248},{"id":429,"depth":174,"text":430},{"id":458,"depth":168,"text":459,"children":787},[788,789,790],{"id":462,"depth":174,"text":463},{"id":477,"depth":174,"text":478},{"id":493,"depth":174,"text":494},{"id":580,"depth":168,"text":581,"children":792},[793,794,795],{"id":584,"depth":174,"text":585},{"id":598,"depth":174,"text":599},{"id":610,"depth":174,"text":611},{"id":622,"depth":168,"text":623},{"id":697,"depth":168,"text":698},{"id":735,"depth":168,"text":736},{"id":760,"depth":168,"text":761},"2026-05-28","How ROT13 appears in coding challenges, CTFs, and interview puzzles — pattern recognition, decoding strategies, and practice problems.","md",{"immutable":225},"\u002Fguides\u002Frot13-programming-puzzles",{"title":5,"description":801},"guides\u002Frot13-programming-puzzles","BhQDT00Pq6KMJ8XsWX8Hc-RCQENhqiO6ekOxmvdjWNM",1780401336581]