Problem Set 2: Crypto
tl;dr
-
Watch Week 2’s lecture.
-
Infer a user’s initials from their name with
initials.c
. -
Choose two adventures:
-
Implement Caesar’s cipher.
-
Implement Vigenère’s cipher.
-
Crack passwords.
-
-
Submit your code.
-
Submit a form.
Help
For help with Week 2 and Problem Set 2:
-
Watch Zamyla’s walkthroughs herein.
-
Start a discussion with classmates.
Reminders
Per Week 2’s lecture:
-
Use
help50
as needed. -
Use
eprintf
as needed. -
Use
debug50
as needed.
Getting Started
Alright, here we go again!
Log into cs50.io and execute
update50
within a terminal window to make sure your workspace is up-to-date. If you somehow closed your terminal window (and can’t find it!), make sure that Console is checked under the View menu, then click the green, circled plus (+) in CS50 IDE’s bottom half, then select New Terminal.
Next, execute
mkdir ~/workspace/pset2/
at your prompt in order to make a directory called pset2
in your workspace
directory.
Now execute
cd ~/workspace/pset2/
to move yourself into (i.e., open) that directory. Your prompt should now resemble the below.
~/workspace/pset2/ $
If not, retrace your steps and see if you can determine where you went wrong. You can actually execute
history
at the prompt to see your last several commands in chronological order if you’d like to do some sleuthing. You can also scroll through the same one line at a time by hitting your keyboard’s up and down arrows; hit Enter to re-execute any command that you’d like.
FAQs
Not a directory
If you execute, e.g.,
cd ~/workspace/pset2/initials/
and see
bash: cd: /home/ubuntu/workspace/pset2/initials/: Not a directory
odds are you don’t have a pset2/
directory inside of ~/workspace/
and/or you don’t have an initials/
directory inside of ~/workspace/pset2/
. Check as much using ls
(remember how?) or poke around your IDE’s file browser at left. Make sure that:
-
you have a
pset2/
directory inside of~/workspace/
, -
you have an
initials/
directory inside of~/workspace/pset2/
, inside of which isinitials.c
, -
you have an
caesar/
directory inside of~/workspace/pset2/
, inside of which iscaesar.c
, -
you have an
vigenere/
directory inside of~/workspace/pset2/
, inside of which isvigenere.c
, and/or -
you have an
crack/
directory inside of~/workspace/pset2/
, inside of which iscrack.c
.
How to Submit
Be sure you’ve signed up for a GitHub account, per Problem Set 0, and that you’ve logged into and authorized CS50.me at least once, per Problem Set 1!
Step 1 of 4
Execute update50
again to ensure that your IDE is up-to-date.
Step 2 of 4
-
Recall that you were asked to implement the less-comfortable or more-comfortable version of
initials
.-
Be sure that
initials.c
is in~/workspace/pset2/initials/
, as with:cd ~/workspace/pset2/initials/ ls
-
-
Recall that you were asked to implement any two (2) of
caesar
,vigenere
, andcrack
.-
If you implemented
caesar
, be sure thatcaesar.c
is in~/workspace/pset2/caesar/
. -
If you implemented
vigenere
, be sure thatvigenere.c
is in~/workspace/pset2/vigenere/
. -
If you implemented
crack
, be sure thatcrack.c
is in~/workspace/pset2/crack/
.
-
Step 3 of 4
-
To submit the less-comfortable version of
initials
(if you implemented it), executecd ~/workspace/pset2/initials/ submit50 cs50/2017/x/initials/less
inputting your GitHub username and GitHub password as prompted.
-
To submit the more-comfortable version of
initials
(if you implemented it), executecd ~/workspace/pset2/initials/ submit50 cs50/2017/x/initials/more
inputting your GitHub username and GitHub password as prompted.
-
To submit
caesar
(if you implemented it), execute:cd ~/workspace/pset2/caesar/ submit50 cs50/2017/x/caesar
-
To submit
vigenere
(if you implemented it), execute:cd ~/workspace/pset2/vigenere/ submit50 cs50/2017/x/vigenere
-
To submit
crack
(if you implemented it), execute:cd ~/workspace/pset2/crack/ submit50 cs50/2017/x/crack
If you run into any trouble, email sysadmins@cs50.harvard.edu!
You may resubmit any problem as many times as you’d like.
Step 4 of 4
Submit this form!
Your submission should be graded within 2 minutes, at which point your score will appear at cs50.me!
This was Problem Set 2.