Course: Harvard’s CS50
Problem Set 2: Crypto
- Learn how strings work in C.
- Learn some fundamental encryption methods while doing (1).
Print a silly song.
Learn about the Caesar cipher.
Learn about the Vigenère cipher
This is a free-form assignment. Write a des56 password cracker. Design and implementation decisions are left up to you.
I originally wrote a simple version for this assignment that just brute-forced using a hard-coded character set. Something like that should be enough to satisfy the requirements. In fact due to the way they automatically ‘test’ submitted solutions anything more complicated than that may be beyond the scope of the assignment.
However, long after I wrote the first version (and after the end of the course) I went back, poked and prodded and changed the hell out of it and the result is not just a simple implementation any more. It’s something one might actually use in real life.
Uses getopt to get the cli parameters. Options: a dictionary file for a dictionary attack; can specify upper limit of brute force attack; can choose from predefined charsets to brute force with, or specify one.
This version of vigenere encodes and decodes text.
If you plan to tackle hacker2, you’re sure to need to make your own des56 keys, from simple passwords like ‘abcd’, so your brute force attack can find the solution fast while you debug.