C Programming and CS50: Crack Problem Set
October 31, 2012
After finishing law school and taking the Georgia bar exam, I began looking for something else to learn. I have always enjoyed learning new things, especially when they deal with technology. I had always wanted to learn to program in a real programming language (not counting VBA, SQL, HTML/CSS, etc. as “real” languages), so I was browsing through iTunes U and came across CS50, an introductory computer science class from Harvard. The iTunes U cast was a little weak, but I found the site cs50.tv to be great. So I started on my journey to learn basic C programming.
Since I have some basic knowledge of general programming principles through my use of VBA, I was able to get off to a quick start with the first couple of problem sets. Then things started to get interesting. One of the problem sets was designing a program that could crack a simple DES-encrypted password. That one stumped me for awhile, but I was finally able to come up with a solution using a brute force method that cycles through each position in an 8 character string, trying all printable characters for each position.
I thought of it like a car’s odometer. You start with 1-9, then when you have used all of those, the next digit becomes a 1, and you repeat with the first digit, running through 1-9, then switching the next digit to 2, and so on until you have tried all of the printable ASCII characters in each position. The main downside to this approach is it takes a long time to crack anything over a couple digits long.
Overall so far this course has been interesting and educational, although I may be investing more time into it than I should. But for personal enjoyment and edification, it has been wonderful, especially after finishing a successful program to a complicated problem set.
Written by Dan Smith who lives and works in Atlanta doing random stuff. You should follow him on Twitter