💾 Archived View for icolotl.com › repos › morgsub › README.md captured on 2024-05-26 at 14:49:40.

View Raw

More Information

-=-=-=-=-=-=-

# MORGSUB (Morgana's Offline-First Substitution Cypher Breaker)

## Introduction

This is a fairly basic substitution cypher breaker, taking in a cypher from standard input and displaying progress info and the (hopefully) broken message to standard output. There's a lot more that could be done for more efficient or successful cypher breaking, however as a quick OFFLFIRSOCH submission there wasn't enough time for advanced features -- maybe next March I'll implement a few more features.
For more information, see the relevant Retrace post (on [Gemini](https://geminiprotocol.net/)) at [0x0005-acanthus-spinosus](gemini://icolotl.com/gemlog/0x0005-acanthus-spinosus).

## Usage

The program reads from standard input, so you can pipe input text to the program or enter it interactively followed by a EOF (usually Ctrl-D on most terminals.) Note it is ready for input after it displays the number of words it has read in, usually `Length: 3421`. Also note that this program requires a fairly large input cyphertext -- it is unable to translate just a sentence or two!

## Examples

### Sample Input / Command:

$ echo "Uivg kpmzzg axmkqma ivl kctbqdiza jtwwu jmbemmv Uizkp ivl Ixzqt qv bpm Vwzbpmzv Pmuqaxpmzm. Eqtl kpmzzg bzmma, mdmv qn bpmg izm bpm aium axmkqma, lqnnmz omvmbqkittg nzwu wvm qvlqdqlcit bw ivwbpmz. Mdmv qn bpmg izm xtivbml qv bpm aium izmi, bpmzm qa awum dizqibqwv qv bpm bqum epmv bpmg zmikp nctt jtwwu. Qv kwvbziab, kctbqdiza izm ktwvma xzwxioibml jg ozinbqvo wz kcbbqvo, aw mikp bzmm wn bpm aium kctbqdiz xtivbml qv bpm aium izmi eqtt kwum qvbw nctt jtwwu itt ib wvkm lcm bw bpmqz omvmbqk aquqtizqbg. Awum eqtl axmkqma, ackp ia Mlw pqoiv ivl bpm kctbqdiza lmdmtwxml nzwu bpmu, izm qv nctt jtwwu jmnwzm bpm tmidma wxmv. Gwapqvw kpmzzg jmkium xwxctiz nwz kpmzzg-jtwaawu dqmeqvo jmkicam wn bpmam kpizikbmzqabqka wn aquctbivmwca ntwemzqvo ivl jtwwuqvo jmnwzm bpm tmidma wxmv; qb itaw jmiza uivg ntwemza ivl ozwea qvbw i tizom bzmm. Uivg kctbqdiza wn bpm Aibw-hisczi ozwcx, epqkp emzm lmdmtwxml nzwu kwuxtmf qvbmzaxmkqnqk pgjzqla jiaml wv Wapqui kpmzzg, izm wnbmv caml nwz wzviumvbit xczxwama. Bpmg omvmzittg zmikp nctt jtwwu i nme liga bw bew emmsa inbmz Gwapqvw kpmzzg lwma. Bpm ntwemzqvo bqum wn kpmzzg bzmma qa bpwcopb bw jm innmkbml jg otwjit eizuqvo ivl bpm pmib qativl mnnmkb wn czjivqhibqwv. Ikkwzlqvo bw bpm zmkwzl wn nctt jtwwu libma wn Xzcvca riuiaisczi (Giuihisczi) [ri] qv Sgwbw, Rixiv, epqkp pia jmmv zmkwzlml nwz ijwcb 1200 gmiza, bpm bqum wn nctt jtwwu eia zmtibqdmtg abijtm nzwu 812 bw bpm 1800a. Inbmz bpib, bpm bqum wn nctt kwtwz zixqltg jmkium miztqmz, ivl qv 2021, bpm miztqmab nctt jtwwu libm qv 1200 gmiza eia zmkwzlml. Bpm idmziom xmis jtwwu lig qv bpm 1850a eia izwcvl Ixzqt 17, jcb jg bpm 2020a, qb eia Ixzqt 5; bpm idmziom bmuxmzibczm zwam jg ijwcb 3.4 °K (6.1 °N) lczqvo bpqa bqum. Ikkwzlqvo bw bpm zmkwzl wn nctt jtwwu libma wn bpm Gwapqvw kpmzzg qv bpm Bqlit Jiaqv qv Eiapqvobwv, L.K., bpm jtwwu libm eia Ixzqt 5 qv 1921, jcb qb eia Uizkp 31 qv 2021. Bpmam zmkwzla izm kwvaqabmvb eqbp bpm pqabwzg wn zixql qvkzmiama qv otwjit umiv bmuxmzibczm aqvkm bpm uql-1800a." | ./morgsub


### Sample Output:

Length: 3421

{'m': 203, 'c': 40, 'h': 3, 'j': 37, 't': 81, 'd': 17, 'n': 49, 'o': 25, 'v': 82, 'a': 87, 'g': 35, 'k': 57, 'y': 0, 'p': 75, 'l': 49, 's': 6, 'f': 1, 'b': 119, 'i': 136, 'r': 3, 'w': 120, 'x': 30, 'q': 100, 'u': 50, 'e': 25, 'z': 119}

['m', 'i', 'w', 'b', 'z', 'q', 'a', 'v', 't', 'p', 'k', 'u', 'l', 'n', 'c', 'j', 'g', 'x', 'o', 'e', 'd', 's', 'r', 'h', 'f', 'y']

===== ITERATION 1 =====

0: 0 -> 0.04385965 :: 0.04385965

23: 0.04385965 -> 0.064327486 :: 0.020467836

39: 0.064327486 -> 0.06725146 :: 0.002923973

41: 0.06725146 -> 0.07309941 :: 0.0058479533

49: 0.07309941 -> 0.07602339 :: 0.0029239804

58: 0.07602339 -> 0.078947365 :: 0.002923973

64: 0.078947365 -> 0.081871346 :: 0.0029239804

84: 0.081871346 -> 0.114035085 :: 0.03216374

103: 0.114035085 -> 0.116959065 :: 0.0029239804

183: 0.116959065 -> 0.11988304 :: 0.002923973

184: 0.11988304 -> 0.12865497 :: 0.008771934

201: 0.12865497 -> 0.13450292 :: 0.005847946

248: 0.13450292 -> 0.14035088 :: 0.0058479607

620: 0.14035088 -> 0.14327486 :: 0.0029239804

656: 0.14327486 -> 0.16081871 :: 0.017543852

877: 0.16081871 -> 0.20175439 :: 0.04093568

900: 0.20175439 -> 0.20760234 :: 0.005847946

1114: 0.20760234 -> 0.21637426 :: 0.008771926

1156: 0.21637426 -> 0.21929824 :: 0.0029239804

1160: 0.21929824 -> 0.23391813 :: 0.014619887

1628: 0.23391813 -> 0.23684211 :: 0.0029239804

2173: 0.23684211 -> 0.23976608 :: 0.0029239655

wtrp gnehhp adegmea try glfomvtha bfuuw beoxeer wthgn try tdhmf mr one ruhonehr newmadnehe xmfy gnehhp oheea ever ms onep the one atwe adegmea ymsseh zereomgtffp shuw ure mrymvmyltf ou truoneh ever ms onep the dftroey mr one atwe thet onehe ma auwe vthmtomur mr one omwe xner onep hetgn slff bfuuw mr gurohtao glfomvtha the gfurea dhudtztoey bp zhtsomrz uh gloomrz au etgn ohee us one atwe glfomvth dftroey mr one atwe thet xmff guwe mrou slff bfuuw tff to urge yle ou onemh zereomg amwmfthmop auwe xmfy adegmea algn ta eyu nmztr try one glfomvtha yevefudey shuw onew the mr slff bfuuw besuhe one fetvea uder puanmru gnehhp begtwe dudlfth suh gnehhpbfuaauw vmexmrz begtlae us oneae gnthtgoehmaomga us amwlfotreula sfuxehmrz try bfuuwmrz besuhe one fetvea uder mo tfau betha wtrp sfuxeha try zhuxa mrou t fthze ohee wtrp glfomvtha us one atouktjlht zhuld xnmgn xehe yevefudey shuw guwdfeq mroehadegmsmg npbhmya btaey ur uanmwt gnehhp the usoer laey suh uhrtwerotf dlhduaea onep zerehtffp hetgn slff bfuuw t sex ytpa ou oxu xeeja tsoeh puanmru gnehhp yuea one sfuxehmrz omwe us gnehhp oheea ma onulzno ou be tssegoey bp zfubtf xthwmrz try one neto maftry essego us lhbtrmktomur tgguhymrz ou one heguhy us slff bfuuw ytoea us dhlrla itwtatjlht ptwtktjlht it mr jpuou itdtr xnmgn nta beer heguhyey suh tbulo petha one omwe us slff bfuuw xta heftomvefp aotbfe shuw ou one a tsoeh onto one omwe us slff gufuh htdmyfp begtwe ethfmeh try mr one ethfmeao slff bfuuw ytoe mr petha xta heguhyey one tvehtze detj bfuuw ytp mr one a xta thulry tdhmf blo bp one a mo xta tdhmf one tvehtze oewdehtolhe huae bp tbulo g s ylhmrz onma omwe tgguhymrz ou one heguhy us slff bfuuw ytoea us one puanmru gnehhp mr one omytf btamr mr xtanmrzour yg one bfuuw ytoe xta tdhmf mr blo mo xta wthgn mr oneae heguhya the guramaoero xmon one nmaouhp us htdmy mrghetaea mr zfubtf wetr oewdehtolhe amrge one wmya

===== ITERATION 2 =====

[... extra output cut ...]

===== FINAL OUTPUT =====

many cherry species and cultivars bloom between march and april in the northern hemisphere wild cherry trees even if they are the same species differ genetically from one individual to another even if they are planted in the same area there is some variation in the time when they reach full bloom in contrast cultivars are clones propagated by grafting or cutting so each tree of the same cultivar planted in the same area will come into full bloom all at once due to their genetic similarity some wild species such as edo higan and the cultivars developed from them are in full bloom before the leaves open yoshino cherry became popular for cherryblossom viewing because of these characteristics of simultaneous flowering and blooming before the leaves open it also bears many flowers and grows into a large tree many cultivars of the satoqakura group which were developed from complex interspecific hybrids based on oshima cherry are often used for ornamental purposes they generally reach full bloom a few days to two weeks after yoshino cherry does the flowering time of cherry trees is thought to be affected by global warming and the heat island effect of urbaniqation according to the record of full bloom dates of prunus jamasakura yamaqakura ja in kyoto japan which has been recorded for about years the time of full bloom was relatively stable from to the s after that the time of full color rapidly became earlier and in the earliest full bloom date in years was recorded the average peak bloom day in the s was around april but by the s it was april the average temperature rose by about c f during this time according to the record of full bloom dates of the yoshino cherry in the tidal basin in washington dc the bloom date was april in but it was march in these records are consistent with the history of rapid increases in global mean temperature since the mids