Trying to understand more of the functions in Mathematica related to operations on text, I am trying to solve the following, I have obtained from :
Vigenère cipher/Cryptanalysis
This is what I have done in an attempt to resolve this problem:
text = "MOMUD EKAPV TQEFM OEVHP AJMII CDCTI FGYAG JSPXY ALUYM NSMYH
VUXJE LEPXJ FXGCM JHKDZ RYICU HYPUS PGIGM OIYHF WHTCQ KMLRD
ITLXZ LJFVQ GHOLW CUHLO MDSOE KTALU VYLNZ RFGBX PHVGA LWQIS
FGRPH JOOFW GUBYI LAPLA LCAFA AMKLG CETDW VOELJ IKGJB XPHVG
ALWQC SNWBU BYHCU HKOCE XJEYK BQKVY KIIEH GRLGH XEOLW AWFOJ
ILOVV RHPKD WIHKN ATUHN VRYAQ DIVHX FHRZV QWMWV LGSHN NLVZS
JLAKI FHXUF XJLXM TBLQV RXXHR FZXGV LRAJI EXPRV OSMNP KEPDT
LPRWM JAZPK LQUZA ALGZX GVLKL GJTUI ITDSU REZXJ ERXZS HMPST
MTEOE PAPJH SMFNB YVQUZ AALGA YDNMP AQOWT UHDBV TSMUE UIMVH
QGVRW AEFSP EMPVE PKXZY WLKJA GWALT VYYOB YIXOK IHPDS EVLEV
RVSGB JOGYW FHKBL GLXYA MVKIS KIEHY IMAPX UOISK PVAGN MZHPW
TTZPV XFCCD TUHJH WLAPF YULTB UXJLN SIJVV YOVDJ SOLXG TGRVO
SFRII CTMKO JFCQF KTINQ BWVHG TENLH HOGCS PSFPV GJOKM SIFPR
ZPAAS ATPTZ FTPPD PORRF TAXZP KALQA WMIUD BWNCT LEFKO ZQDLX
BUXJL ASIMR PNMBF ZCYLV WAPVF QRHZV ZGZEF KBYIO OFXYE VOWGB
BXVCB XBAWG LQKCM ICRRX MACUO IKHQU AJEGL OIJHH XPVZW JEWBA
FWAML ZZRXJ EKAHV FASMU LVVUT TGK";
We erased the spaces of the variable txt
junto = StringJoin[StringSplit[text]];
largo = StringLength[junto];
freq = Table[
StringCount[junto, StringTake[junto, {i, i + 2}]], {i, 1, 826}];
Tally[DeleteCases[freq, 1]]
I have done so we are looking for the position of the trigrams used within the text,
StringTake[junto, {#, # + 2}] & /@ Flatten[Position[freq, 4]]
DeleteDuplicates[
StringTake[junto, {#, # + 2}] & /@ Flatten[Position[freq, 3]]]
Calcualte prb for use later
prb = StringPosition[junto, #] & /@ {"UXJ", "CUH", "BYI", "TUH",
"XJL"}
for example we calculate the differences of prb, to know the distances between each repetition of a Trigrama.
DeleteDuplicates[Flatten[Differences[#, {1, 0}] & /@ prb]]
Here decompose each number into its prime factors to try to find the possible differente in the key of the cipher text is clearly seen that the numbers that most times are repeated are the 2 and 7, i thought that the key could be 7,but i have not received anything in particular
Tally[Flatten[#[[;; , 1]] & /@
FactorInteger[{524, 126, 42, 98, 322, 252, 168, 266}]]]
Perhaps a different approach can help me
Any help is welcome, thaks in advance.