Challenge : apply these methods to crack simple codes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Challenge : apply these methods to crack simple codes

Many texts are crypted using simple methods like https://www.sololearn.com/Discuss/981018/?ref=app Make a program that runs the following attacks on a crypted text 1- Use letters frequency to try to "recognize" letters (see hereunder frequencies for the 1st letter of english words and all the letters) 2- Display the first tens of characters of the text using all the caesar possibilities 3- XOR each ascii code with a constant value for different values of XOR masks giving enough letters or digits as % of the total size of the text 4-any other additionnal method firstchar=[0.11682,0.04434,0.05238,0.03174,0.02799,0.04027,0.01642,0.042,0.07294,0.00511,0.00456,0.02415,0.03826,0.02284,0.07631,0.04319,0.00222,0.02826,0.06686,0.15978,0.01183,0.00824,0.05497,0.00045,0.00763,0.00045] allchar=[0.08167,0.01492,0.02782,0.04253,0.12702,0.02228,0.02015,0.06094,0.06966,0.00153,0.00772,0.04025,0.02406,0.06749,0.07507,0.01929,0.00095,0.05987,0.06327,0.09056,0.02758,0.00978,0.0236,0.0015,0.01974,0.00074]

5th Jan 2018, 9:57 PM
VcC
VcC - avatar
9 Answers
+ 14
Another great challenge again! Serious I think VcC your skill in algorithm is far better than most of us here, including me. 👍😉
5th Jan 2018, 7:33 AM
Zephyr Koo
Zephyr Koo - avatar
+ 2
@zephyr Stop flattering, start coding ;-) !
5th Jan 2018, 8:17 PM
VcC
VcC - avatar
+ 2
bugs fixed it will give you several clear possibilities. https://code.sololearn.com/cUQA58NCL1Mq/?ref=app
6th Jan 2018, 4:14 AM
abdulazizumarovich
abdulazizumarovich - avatar
+ 2
This one does #2, ie brute force on a Caesar cipher: https://code.sololearn.com/cB6quUzeSLtV
6th Jan 2018, 11:32 AM
Jared Bird
Jared Bird - avatar
+ 2
https://code.sololearn.com/c7qc0rOjP2eW/?ref=app
7th Jan 2018, 10:24 PM
VcC
VcC - avatar
+ 1
Can explain what you mean by #3? Is that a try all 255 bytes combinations? ie Bute force.
5th Jan 2018, 7:34 AM
Jared Bird
Jared Bird - avatar
+ 1
@jared : yes for example. but you might consider other methods. Xor is proposed because it is sometimes used in simplist cryptos. Alternatively you can limit to the case when xor gives readable characters (31-127 ascii) and has enough letters+digits as a % of total characters...
5th Jan 2018, 9:55 PM
VcC
VcC - avatar
0
examples. look at the xor method https://code.sololearn.com/cgZm0YxU3mov/?ref=app
5th Jan 2018, 11:24 PM
VcC
VcC - avatar
0
Here is a code to crack a code using text statistics. relaunch if the result is bad Feel free to clean and improve (there could be better ways to use 2 3 4grams to guess the first code)
7th Jan 2018, 10:22 PM
VcC
VcC - avatar